"Parameter redirect_uri does not match registered URI"


#1

I had made no changes to my code or my application and started getting this error yesterday: “Parameter redirect_uri does not match registered URI”

Following the advice of similar posts on these forums, I have tried remaking my app and also tried making the app on another account to no avail. Obviously I changed my clientId/client secret when I tried this. Nothing is working that I can think of.

redirect url in my code: https://mydomain.com/twitchcallback
redirect in the url on the page to approve the app: https://mydomain.com/twitchcallback
redirect in my app on the twitch developers dashboard: https://mydomain.com/twitchcallback

Is anyone else having this issue, is there a known bug right now?


#2

A RedirectURI usually should end in a /

I predict the issue is that the panel/console has auto added a / to the end (usually chrome auto fill)

Hence the conflict.

Check that you are using the correct clientID in your code as well

At the moment I cannot replicate your issue, but I end all my redirect URI’s with /

Additionally if you have changed your redirect URI, it’ll take 2/3 minutes before the changes are replicated “on production”


#3

Thanks for the quick response @BarryCarlyon you do great work here.

Unfortunately, adding the trailing / did not change anything, I waited 5 minutes, re-copied my client id/client secret just to be sure and was not successful.
the redirect url in all 3 places is now:
https://mydomain.com/twitchcallback/
https://mydomain.com/twitchcallback/
https://mydomain.com/twitchcallback/

I realize I am most likely just missing something obvious, but is there anything else you can think of? I will continue testing and report back if I find a fix. Again, thank you for your response.


#4

Can you provide your tool/site so I can take a look and spot obviouses and/or the URL you are redirecting to Twitch with?

(ClientID’s are considered public btw)


#5

sure the website I am working on is https://bitcornsync.com and the URL I am using is https://id.twitch.tv/oauth2/authorize?client_id=wnl8ofrydt837n586ig3nmus2e8ezu&redirect_uri=https://bitcornsync.com/twitchcallback/&response_type=code&scope=openid


#6

Seems ok to me. I got to the auth screen.

Do you have a Chrome Plugin that might be interuppting the headers and is changing your ClientID for something else?

Test your auth loop in chrome incognito


#7

No dice in incognito


#8

I hit authorize and hit your error screen.

But I can’t see anything wrong.

You getting the Error before or after the “authorize/cancel” dialog?


#9

After


#10

And you are following

And Posting

POST https://id.twitch.tv/oauth2/token
    ?client_id=<your client ID>
    &client_secret=<your client secret>
    &code=<authorization code received above>
    &grant_type=authorization_code
    &redirect_uri=<your registered redirect URI>

?


#11

Yes sir, trying other browsers now


#12

Emphasis on redirect_uri=https://bitcornsync.com/twitchcallback/

Otherwise I’m out of ideas outside of Syntax errors in your code somewhere…


#13

Thank you for your time, I will continue to keep plugging away and report back if I figure it out.


#14

I have no specific solution to share, I just rewrote code until it worked. Eventually it worked. I would love to share some sort of explanation for anyone finding this in the future, but unfortunately have none. Thanks again for your help @BarryCarlyon keep up the awesome work.


#15

I noticed you did not properly encode your uri query params. So &redirect_uri=https://bitcornsync.com/twitchcallback should actually be &redirect_uri=https%3A%2F%2Fbitcornsync.com%2Ftwitchcallback, though all characters there look unambiguous as a query param value, so I don’t think it was the actual issue.


#16

Doesn’t matter as the problem is in the POST for the token exchange. Not in the initial outbound redirect. As earlier noted in the thread, as the initial outbound redirect is not throwing the “Redirect URI Invalid” error