TwurpleAuthenticationGetting dataExamplesFAQMigration

AccessTokenMaybeWithUserId

Represents the data of an OAuth access token returned by Twitch, together with the ID of the user it represents, if it's not an app access token.

{
The access token which is necessary for every request to the Twitch API.
accessToken: string
The time, in seconds from the obtainment date, when the access token expires.
expiresIn: number | null
The date when the token was obtained, in epoch milliseconds.
The refresh token which is necessary to refresh the access token once it expires.
refreshToken: string | null
The scope the access token is valid for, i.e. what the token enables you to do.
scope: string[]
The ID of the user represented by the token, or undefined if it's an app access token.
userId?: string
}

Properties

accessToken

Type: string

The access token which is necessary for every request to the Twitch API.

expiresIn

Type: number | null

The time, in seconds from the obtainment date, when the access token expires.

May be null, in which case the token does not expire. This can only be the case with very old Client IDs.

This does not honor the expiry grace period; it contains the exact value from Twitch.

obtainmentTimestamp

Type: number

The date when the token was obtained, in epoch milliseconds.

refreshToken

Type: string | null

The refresh token which is necessary to refresh the access token once it expires.

scope

Type: string[]

The scope the access token is valid for, i.e. what the token enables you to do.

userId

Type: ?string

The ID of the user represented by the token, or undefined if it's an app access token.