How do I use an "OAuth Redirect URL" with Glitch?

Hey all! I’m trying to figure my way around Twitch’s PubSub API, and unlike the IRC stuff which just needed an Oauth token, PubSub seems to require me to register the application and get a client and refresh token.

Trouble is I’m kinda falling at the first hurdle, where twitch asks for a redirect URL, and I’ve no idea how to find out what mine would be for my glitch project…!

(Please don’t worry about sounding condescending if this is a dumb question, you are MORE than welcome to explain this to me like I’m 5 :sweat_smile: )

Hiya,

During OAuth:

  • Your site redirects to the twitch (or whatever) login prompt
  • The user enters their details
  • twitch verifies them
  • twitch “pings back” to your OAuth URL with either the token (if they logged in right) or a failure message
  • you store the token they sent you and include it in future requests

It is your job to create a URL route that twitch can hit with their OAuth callback. You can make it as an Express/Fastify route, making sure that the parameters match whatever is in the twitch docs.

Once you’ve created that URL, make sure (as the screenshot says) that it is the same one you pass in the redirect_uri parameter!

So, for example, you might create myproject.glitch.me/authcallback and program it to consume the data sent in the twitch response, and store it.

There is probably more detail in the twitch docs about what your OAuth callback should do!

Hope it helps :slight_smile:

2 Likes

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