Missing response_type error

Hi,
For login, I redirect the user to the following url with js:

var url = "https://id.twitch.tv/oauth2/authorize?client_id="+clientid+"&redirect_uri="+redirecturi+"&response_type=code&scope="+scope+"&force_verify=true";     

However, when redirected, I get the following error saying that a response type is missing despite the fact that I gave it in the query’s url:

{"status":400,"message":"missing response type"}

Thank you in advance for your help

Your redirecturi is not URL encoded.

So your twitch login links reads:

  • Goto https://id.twitch.tv/oauth2/authorize
  • With client_id=clientid
  • With Redirect URI redirect_uri="+redirecturi+"&response_type=code&scope="+scope+"&force_verify=true"

You need to URIEncode the Redirect URI.

This looks like JS so the “fix” is

var url = "https://id.twitch.tv/oauth2/authorize?client_id="+clientid+"&redirect_uri="+encodeURIComponent(redirecturi)+"&response_type=code&scope="+scope+"&force_verify=true";     

as per this exmaple

document.getElementById('authorize_public').setAttribute('href', 'https://id.twitch.tv/oauth2/authorize?client_id=' + client_id + '&redirect_uri=' + encodeURIComponent(redirect) + '&response_type=token');

https://barrycarlyon.github.io/twitch_misc/authentication/implicit_auth/