Skip to content

UpDownLeftDie/twitch-oauth-helper

Repository files navigation

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)

parameter key description
settings clientId Twitch App Client ID
settings clientSecret Twitch App Secret
settings redirectUri (Optional) Where initial authorization request should redirect too
settings scope (Optional) space-separated list of scopes
forceRefresh (Optional) Forces the accessToken to be refreshed

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published