Authentication doubts

Since your server is using Express, when Twitch sends the user back to your redirect URL you can just access the code querystring param in your handler for that route and do the remaining steps of the auth process, before redirecting the user to their intended page.

What you may want to do is use a separate route for the callback, so rather than http://localhost:8080 you might use http://localhost:8080/twitchAuth and then have a route for /twitchAuth that takes the code express provides in req.query, makes the POST request to get the access_token, and then redirects the user back to the default route for your site.

1 Like