Constructor
new TokenManager(client, optsopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
client |
* | (TypeScript: |
|
opts |
Object |
<optional> |
(TypeScript: |
- Source:
Classes
Methods
close()
Cancels all rotation timers (call on shutdown).
- Source:
(async) delete(key, optsopt) → {Promise.<(GrantSet|undefined)>}
Removes the grant for key, optionally revoking it at the AS: the whole grant (section 5.4), or with
revoke: 'token' only its access token (section 6.2).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | ||
opts |
Object |
<optional> |
(TypeScript: |
- Source:
Returns:
- Type
- Promise.<(GrantSet|undefined)>
(async) get(key) → {Promise.<(GrantSet|undefined)>}
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source:
Returns:
The cached grant (possibly expired) for key.
- Type
- Promise.<(GrantSet|undefined)>
(async) getTokenSet(key, optsopt) → {Promise.<GrantSet>}
Returns the cached grant for key, rotating first if the access token is (nearly) expired.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | ||
opts |
Object |
<optional> |
(TypeScript: |
- Source:
Returns:
- Type
- Promise.<GrantSet>
rotate(key) → {Promise.<GrantSet>}
Rotates key's access token now. Concurrent calls share a single request.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source:
Returns:
- Type
- Promise.<GrantSet>
(async) schedule(key) → {Promise.<void>}
Schedules the proactive rotation of the token already stored for key.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source:
Returns:
- Type
- Promise.<void>
(async) set(key, grantSet, optsopt) → {Promise.<GrantSet>}
Stores a grant for a key and (unless schedule: false) schedules its proactive rotation.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | ||
grantSet |
GrantSet | object | ||
opts |
Object |
<optional> |
(TypeScript: |
- Source:
Returns:
- Type
- Promise.<GrantSet>
unschedule(key)
Stops rotating key's token in the background; it stays stored.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source: