1.0.1 • Published 4 years ago

@jlengstorf/get-twitch-oauth v1.0.1

Weekly downloads
68
License
MIT
Repository
github
Last release
4 years ago

Get an Twitch OAuth Token for Server-to-Server Requests

If you, like me, are running chatbots and other streaming tools, you’ll need an OAuth token as of May 11, 2020.

I built this helper to create a convenient way to quickly get that access token for use in my various streaming bots and apps.

Quickstart

1. Install the package

# install the package
npm i @jlengstorf/get-twitch-oauth

2. Set environment variables

TWITCH_CLIENT_ID=<YOUR_TWITCH_CLIENT_ID>
TWITCH_CLIENT_SECRET=<YOUR_TWITCH_CLIENT_SECRET>

3. Get a token

const { getTwitchAccessToken } = require('@jlengstorf/get-twitch-oauth');
const { access_token } = getTwitchAccessToken();

For a more complete example, see demo/index.js.

API

paramrequireddefaultdescription
client_idnoprocess.env.TWITCH_CLIENT_IDyour Twitch app’s client ID
client_secretnoprocess.env.TWITCH_CLIENT_SECRETyour Twitch app’s client secret
grant_typeno"client_credentials"for app-to-app tokens, this must be "client_credentials"
scopesno""any permission scopes required by your app