Overview
Properties
You are advised to roll your own auth provider that can handle scope upgrades, or to plan ahead and supply only access tokens that account for all scopes you will ever need.
Constructor
new StaticAuthProvider(clientId, accessToken, scopes)
Creates a new auth provider with static credentials.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
clientId | string | none | The client ID of your application. | |
accessToken | string | AccessToken | none | The access token to provide. You need to obtain one using one of the Twitch OAuth flows. | |
scopes | string[] | none | The scopes the supplied token has. If this argument is given, the scopes need to be correct, or weird things might happen. If it's not (i.e. it's If you can't exactly say which scopes your token has, don't use this parameter/set it to |
Properties
Methods
getAccessTokenForIntent(intent, scopeSets)
asyncGets the static access token.
If the current access token does not have the requested scopes, this method throws. This makes supplying an access token with the correct scopes from the beginning necessary.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
intent | string | none | Ignored. | |
scopeSets | (?string[])[] | none | The requested scopes. |
getAccessTokenForUser(user, scopeSets)
asyncGets the static access token.
If the current access token does not have the requested scopes, this method throws. This makes supplying an access token with the correct scopes from the beginning necessary.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | Ignored. | |
scopeSets | (?string[])[] | none | The requested scopes. |