@jlengstorf/get-twitch-oauth
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

param required default description
client_id no process.env.TWITCH_CLIENT_ID your Twitch app’s client ID
client_secret no process.env.TWITCH_CLIENT_SECRET your Twitch app’s client secret
grant_type no "client_credentials" for app-to-app tokens, this must be "client_credentials"
scopes no "" any permission scopes required by your app

Readme

Keywords

none

Package Sidebar

Install

npm i @jlengstorf/get-twitch-oauth

Weekly Downloads

10

Version

1.0.1

License

MIT

Unpacked Size

6.97 kB

Total Files

4

Last publish

Collaborators

  • jlengstorf