RefreshableAuthProvider
Enhances another auth provider with the ability to make use of refresh tokens, automatically refreshing the access token whenever necessary.
Overview
Properties
Methods
Constructor
new RefreshableAuthProvider(childProvider, refreshConfig)
Creates a new auth provider based on the given one that can automatically refresh access tokens.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
childProvider | AuthProvider | none | The base auth provider. |
|
refreshConfig | RefreshConfig | none |
The information necessary to automatically refresh an access token. |
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 token an auth provider can return - user tokens and app tokens are supported.
Aliased type: "user" | "app"
The type of tokens the provider generates.
It is the same as the underlying base auth provider's token type.
Methods
getAccessToken(scopes)
asyncRetrieves an access token.
If the current access token does not have the requested scopes, the base auth provider is called.
If the current access token is expired, automatically renew it.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
scopes | string | Array<string> | none | The requested scopes. |