Constructor
new TokenManager(client, optsopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
client |
* | (TypeScript: |
|
opts |
Object |
<optional> |
(TypeScript: |
- Source:
Classes
Methods
close()
Cancels all refresh timers (call on shutdown).
- Source:
(async) delete(key, optsopt)
Removes tokens for key, optionally revoking them at the OP (RFC 7009).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | ||
opts |
Object |
<optional> |
(TypeScript: |
- Source:
(async) get(key) → {Promise.<(TokenSet|undefined)>}
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source:
Returns:
Cached tokens (possibly expired) for key.
- Type
- Promise.<(TokenSet|undefined)>
(async) getAccessToken(key, optsopt) → {Promise.<string>}
Returns a usable access token for key, refreshing first if it is expired or about to expire.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | ||
opts |
Object |
<optional> |
(TypeScript: |
- Source:
Returns:
- Type
- Promise.<string>
(async) getTokenSet(key, optsopt) → {Promise.<TokenSet>}
Returns the cached TokenSet for key, refreshing first if the access token is (nearly) expired. Use this rather than getAccessToken() when the token may be DPoP-bound: the caller needs its token_type to build the right Authorization header (OIDCClient.resourceHeaders()).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | ||
opts |
Object |
<optional> |
(TypeScript: |
- Source:
Returns:
- Type
- Promise.<TokenSet>
refresh(key) → {Promise.<TokenSet>}
Refreshes tokens for key now. Concurrent calls share a single request.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source:
Returns:
- Type
- Promise.<TokenSet>
(async) schedule(key) → {Promise.<void>}
Schedules the proactive refresh of the tokens already stored for key.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source:
Returns:
- Type
- Promise.<void>
(async) set(key, tokenSet, optsopt)
Stores tokens for a key and (unless schedule: false) schedules their proactive refresh.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | ||
tokenSet |
TokenSet | object | ||
opts |
Object |
<optional> |
(TypeScript: |
- Source:
unschedule(key)
Stops refreshing key's tokens in the background; they stay stored.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string |
- Source: