# new TokenMaintainer(args)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
Object | ||
accountId |
string | the brand's accountId |
|
authData |
Object | username and password to generate Bearer token |
|
authSessionInfo |
Object |
<optional> |
response object from TokenMaintainer#getAuthSessionInfo |
Methods
# async _generateToken()
Wraps the token generation function. Ensuring that only one token generation is happening at a time
# async _generateTokenInner()
Generates an agent token for connecting to UMS
# async _refreshToken()
Refreshes the token for a connection
# async getAuthSessionInfo() → {Promise.<Object>}
Returns authSessionInfo from agentVep, awaiting any ongoing token regeneration process
token maintainer not started
authSessionInfo
# async getToken() → {Promise.<string>}
Returns a valid token, awaiting any ongoing token regeneration process
token maintainer not started
Agent bearer token
# onTokenInvalid()
This function should be called when a 401 is received when using a bearer token. It will attempt to regen the token and resolve if it succeeds; if it fails it will throw an error