1.0.1 • Published 2 years ago

@dylansmr/charcoal-twitch-auth v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Charcoal Twitch Authentication

A simple authentication interface used for Twitch's Helix and IRC systems. This is primarily used internally for Charcoal, however, it can be used for anything else.

IAuthProvider

IAuthProvider is a simple interface that enforces the standardized functions for every actual auth provider such as the Refreshing Auth Provider.

Refreshing Provider

const authProvider = new RefreshingProvider({
    // Required Settings
    refreshToken: "<token">,
    clientId: "<client id>",
    clientSecret: "<client secret>",

    // Optional Settings
    obtainedAt: 0,
    expiresIn: 0,
    onRefresh: (token: RefreshTokenInfo) => {},
    scopes: [ "chat:read", "chat:edit" ]
});

Static Provider

const authProvider = new StaticProvider({
  // Required Fields
  authToken: "<token>",

  // Optional Fields
  scopes: ["chat:read", "chat:edit"],
});