Ideally, it should be able to request a new access token via user input when previously unauthorized scopes are requested.
As a starting point,
StaticAuthProvider
takes an access token, but can't do anything to upgrade it
by itself.
RefreshableAuthProvider
is used as a wrapper around another
AuthProvider
and can make use of refresh tokens.
The type of token an auth provider can return - user tokens and app tokens are supported.
Aliased type: "user" | "app"
Properties
getAccessToken
Type: (scopes: string | Array<string>) => Promise<AccessToken | null>
Retrieves an access token from the provider.
This should automatically request a new token when the current token is not authorized to use the requested scope(s).
When implementing this, you should not do anything major when no scopes are requested - the cached token should be valid for that - unless you know exactly what you're doing.
refresh
Type: ?() => Promise<AccessToken | null>
Requests that the provider fetches a new token from Twitch.
This method is optional to implement. For some use cases, it might not be desirable to e.g. ask the user to log in again at just any time.