1.0.2 • Published 4 years ago

@updownleftdie/twitch-oauth-helper v1.0.2

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
4 years ago

Twitch OAuth Helper

Currently only supports OAuth Authorization Code Flow

Usage

const getTwitchSession = require("./index");
const twitchSession = await getTwitchSession({
  clientId: "...",
  clientSecret: "...",
  redirectUri: "http://localhost",
});
  • On initial call will help obtain accessToken and refreshTokens by providing a link to gain authorization code and wait for user input.
  • When called it will check and automatically refresh a token based on expiration time.

Returns

{
  "clientId": "...",
  "accessToken": "...",
  "refreshToken": "...",
  "expires": "2020-05-11T01:00:00.000Z"
}

Parameters

getTwitchSession(settings, forceRefresh)

parameterkeydescription
settingsclientIdTwitch App Client ID
settingsclientSecretTwitch App Secret
settingsredirectUri(Optional) Where initial authorization request should redirect too
settingsscope(Optional) space-separated list of scopes
forceRefresh(Optional) Forces the accessToken to be refreshed