Run PubSub example locally

Hi! I’ve been trying to run the PubSub example locally from the repo without success:

I’ve updated the scopes and added the needed client ID and using the redirect URI to my localhost:3030 but after login with Twitch info I’ve got an “redirect mismatch”.

https://localhost/?error=redirect_mismatch&error_description=Parameter+redirect_uri+does+not+match+registered+URI&state=3FTuhjlVGJX35SD

This is the actual URL, but I’m confused since in the redirectURI param I’ve passed a not secure http://localhost:3000/

What can be wrong? any ideas? thanks a bunch!

If you’re passing http://localhost:3000/ as a param for the auth URL, is that EXACTLY what you have set in your apps settings in the developer console? It has to be an exact match, including any trailing slashes (or lack thereof).

1 Like

Hi! thanks for the quick answer!

The current URL in my dev console is http://localhost:8080/, I’ve just changed it in the PubSub example and reload. But still getting the redirect mismatch error :frowning:

Looking at the example, it’s significantly outdated and uses endpoints and scopes that don’t exist any more.

Try constructing the auth url yourself by following the step by step documentation Getting OAuth Access Tokens | Twitch Developers as that will that’ll help rule out issues of the guide just being out of date.

It it’s correct in both places, should also give it around 5 minutes in case of any caching on Twitch’s side that can result in a “mistmatch” error.

Hi!

I’ve checked the auth url against the documentation and also allowed +5min wait time but still getting the “mismatch” error. I’m continue looking into this.

What does you “outbound” URL that users click on to be redirect to Twitch look like?

This is the URL used to be redirected to Twitch

https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=2ltzo7xctab0g729501v91hq3qmbby&redirect_uri=http://localhost:8080/&state=936xkqys020XoWd&scope=user_read+chat%3Aedit

Then I got this message from the redirect

image

After clicking continue I get the error. But it’s actually displayed on the URL itself:

https://localhost/?error=redirect_mismatch&error_description=Parameter+redirect_uri+does+not+match+registered+URI&state=936xkqys020XoWd

And the oAuth Redirect URL on the console is exactly the same? for clientID - 2ltzo7xctab0g729501v91hq3qmbby

One thing to try and should be done) is to URI encode the redirect_uri in the query string to help confusions.

So

https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=2ltzo7xctab0g729501v91hq3qmbby&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&state=936xkqys020XoWd&scope=user_read+chat%3Aedit

Poking about it seems that the URI is not in the dashboard doesn’t directly match the URI you are trying to use.

1 Like

Ok! this solved the issue. I thought I have the same OAuth URL but apparently I forgot to add the port, so used exactly the same one and the redirect works ok launching a different Twitch authorisation page. After clicking ok, the new url appends correctly the #access_token and works as intended!

Thanks a bunch!

Hi! another question regarding the example, I got an error 410 while trying to send the request to url https://api.twitch.tv/kraken/user.

I’ve been looking into the documentation, but not sure what should be the right url for this property.

After including the Client ID:

https://api.twitch.tv/kraken/user?client_id=2ltzo7xctab0g729501v91hq3qmbby

still have the 410 but with a message including the docs url: Twitch Developer Documentation | Twitch Developers (https://dev.twitch.tv/docs)

Kraken is dead and no longer documented or supported for use
It was deprecated and removed from active service

You need helix users

Replaced with the new endpoint:
https://api.twitch.tv/helix/users and it’s working ok, thanks again!

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