Constructor
new AnonymousSession(config, tokenManager)
Parameters:
Name | Type | Description |
---|---|---|
config |
Config | The SDK configuration options |
tokenManager |
TokenManager | The TokenManager |
- Source:
Methods
exchangeToken(scopes, resourceopt, optionsopt) → {Promise.<TokenInfo>}
Return the anonymous session token, since there is no need to downscope a
token that does not have any associated user credentials.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
scopes |
string | Array.<string> | The scope(s) requested for the new token | |
resource |
string |
<optional> |
The absolute URL of an API resource to scope the new token to |
options |
TokenRequestOptions |
<optional> |
Sets optional behavior for the token grant |
- Source:
Returns:
Promise resolving to the new token info
- Type
- Promise.<TokenInfo>
getAccessToken(optionsopt) → {Promise.<string>}
Produces a valid, anonymous access token.
Performs a refresh before returning if the current token is expired. If the current
token is considered stale but still valid, return the current token but initiate a
new refresh in the background.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
TokenRequestOptions |
<optional> |
Sets optional behavior for the token grant |
- Source:
Returns:
Promise resolving to the access token
- Type
- Promise.<string>
revokeTokens(optionsopt) → {Promise}
Revokes the anonymous token used by this anonymous session, and clears the saved tokenInfo.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
TokenRequestOptions |
<optional> |
Sets optional behavior for the token grant |
- Source:
Returns:
Promise resolving if the revoke succeeds
- Type
- Promise