Redirect_uri does not match registered URI

Hello All,
I am trying to add a Twitch OAuth to Yii2 which already has many others OAuth clients implemented.
I have read the doc about the authentication API found here and many others posts related the same question as in the title.
Nothing helps. I still get the same error:

‘Request failed with code: 400, message: {“error”:“Bad Request”,“status”:400,“message”:“Parameter redirect_uri does not match registered URI”}’

Here are more details:
=== registered Redirect URI ===

=== Auth URL ===[myclientId]&response_type=code&

For test purposes, after changing the registered Redirect URI to
and readapting the Auth URL, the error disappears.
So I wonder what is wrong in adding the authclient parameter to the registered redirect Uri.

Many thanks in advance for any help, tips or hints to sort this out.

I forgot to mention the url I am redirected to:[codeabddddddddcode]&scope=user_read+channel_read+chat_login
despite the error.

Try using the state query string argument instead of using the authclient query string argument.

I myself use a query string argument on one of mine. But I do:

Using your link as the example. Note the / on the end of the URL. URL’s are supposed/conventionally to end with a / and not be open ended like yours.

Thanks @BarryCarlyon for your reactivity.
Changed the redirect Url at both sides (twitch and App) like you suggested

No luck. Got redirected to

Your OAuth redirect_uri must exactly match that of the one saved for your application in Twitch’s database. If you need to pass stateful information, you should do so through the state parameter.

I had a similar problem. It turned out that I had to be making my request from the page I defined as my registered URI…

I think the JS API checks:
window.location == redirect_uri

in order to verify that requests sent to the service are legit.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.