How to oauth with node?

You tried to “get”/fetch the URL rather than redirect the website user to the URL

Here is an example nodeJS user access generator using Express (for web serving) and Got (for web requests)

The general rule for oAuth is:

  • construct a <a href=" to Twitch oAuth Entry
  • user clicks that link
  • user goes to Twitch
  • user accepts (or declines) the link
  • user comes back to your REDIRECT_URI with a ?code in the parameters
  • you exchange the ?code for an access token you can use

The linked example will do this and then perform a user lookup to get the user for that token

1 Like