Skip to content

Twitch Helix

Created: 2020-02-19 13:43:59 -0800 Modified: 2020-04-04 08:47:02 -0700

  • You need to get all OAuth information before starting (reference, reference2).
    • Make an application here.
      • Specify a redirect URI of http://localhost
      • Click “Manage” to see your client ID, and click “New Secret” to see your client secret. Keep both of those safe somewhere.
    • Go to this URL in your browser:

  • Replace CLIENT_ID with your client ID and the scope with any scopes you may want (like channel:read:subscriptions ), separated by a plus sign.

  • You’ll know it worked if you get a screen with an “Authorize” button

  • It’ll then warn you that you are going to another origin (http://localhost). Click “Continue” and you’ll see a code in your URL bar.

  • Take that code and plug it into this URL in PostMan or Insomnia with the POST method

  • Replace CLIENT_ID, CLIENT_SECRET, and CODE_FROM_LAST_REQUEST with values from before.

  • Click “Send” in your REST client

  • You’ll get back an access token and a refresh token. Save those somewhere safe; you’re ready to go with any API calls now!

The module ships with sourcemaps but without the source that it maps to (which is the “src” folder). To fix this, I just cloned their whole repo, went to packages/twitch, and copied the “src” folder into my own project’s node_modules/twitch/src, and everything worked.

InvalidTokenError: Invalid token supplied

Section titled InvalidTokenError: Invalid token supplied

I got this when I had copy/pasted some example code that had “undefined” for the scopes of the specified token. You’re supposed to specify it