twitcheasy-twitch-bottwitch-authtwitch-auth-tmitwitch-chat-clienttwitch-eventsubtwitch-pubsub-clienttwitch-webhooks

ClientCredentialsAuthProvider

An auth provider that retrieve tokens using client credentials.

Overview

Constructor

new ClientCredentialsAuthProvider(clientId, clientSecret)

Creates a new auth provider to receive an application token with using the client ID and secret.

Parameter Type Required Default Description
clientId string none

The client ID of your application.

clientSecret string none

The client secret of your application.

Properties

tokenType

Type:
AuthProviderTokenType

The type of token an auth provider can return - user tokens and app tokens are supported.

Aliased type: "user" | "app"

The type of tokens the provider generates.

This auth provider generates app tokens.

clientId

Type: string

The client ID.

currentScopes

Type: Array<string>

The scopes that are currently available using the access token.

Methods

getAccessToken(scopes)

async

Retrieves an access token.

If any scopes are provided, this throws. The client credentials flow does not support scopes.

Parameter Type Required Default Description
scopes string | Array<string> none

The requested scopes.

Return type: AccessToken

refresh()

async

Retrieves a new app access token.

Return type: AccessToken