I just followed the documentation for use auth2 with tiktok.
And my code follow that
@Get('/tiktok/redirect')
loginTicTok(
@Res() res,
) {
const csrfState = Math.random().toString(36).substring(2);
res.cookie('csrfState', csrfState, { maxAge: 60000 });
let url =`${this.config.get('tictokURL')}`;
url +=`?client_key=${this.config.get('tictokClientKey')}`;
url +=`&scope=video.upload`;
url += '&response_type=code';
url += '&redirect_uri=https://reelcrm-backend.herokuapp.com/social-network/tiktok/';
res.redirect(url);
}
I think your TikTok request URL is right https://www.tiktok.com/v2/auth/authorize/?client_key=myclientcode&scope=video.upload&response_type=code&redirect_uri=https://reelcrm-backend.herokuapp.com/social-network/tiktok/.
And I also your redirect uri is same but you need to encode your URL parameters tiktok guideline for URL encode parameters.
so try using encoded URL query params this is reference https://developers.tiktok.com/doc/login-kit-web