AccessTokenRefresher class
Warning
This API is now deprecated.
No longer used in the bearer authorization policy.
Helps the core-http token authentication policies with requesting a new token if we're not currently waiting for a new token.
Constructors
Access |
Methods
is |
Returns true if the required milliseconds(defaulted to 30000) have been passed signifying that we are ready for a new refresh. |
refresh(Get |
Requests a new token if we're not currently waiting for a new token. Returns null if the required time between each call hasn't been reached. |
Constructor Details
AccessTokenRefresher(TokenCredential, string | string[], number)
new AccessTokenRefresher(credential: TokenCredential, scopes: string | string[], requiredMillisecondsBeforeNewRefresh?: number)
Parameters
- credential
- TokenCredential
- scopes
-
string | string[]
- requiredMillisecondsBeforeNewRefresh
-
number
Method Details
isReady()
Returns true if the required milliseconds(defaulted to 30000) have been passed signifying that we are ready for a new refresh.
function isReady(): boolean
Returns
boolean
refresh(GetTokenOptions)
Requests a new token if we're not currently waiting for a new token. Returns null if the required time between each call hasn't been reached.
function refresh(options: GetTokenOptions): Promise<undefined | AccessToken>
Parameters
- options
- GetTokenOptions
Returns
Promise<undefined | AccessToken>