ExpiringAccessTokenCache class

Warning

This API is now deprecated.

No longer used in the bearer authorization policy.

Provides an AccessTokenCache implementation which clears the cached AccessToken's after the expiresOnTimestamp has passed.

Constructors

ExpiringAccessTokenCache(number)

Constructs an instance of ExpiringAccessTokenCache with an optional expiration buffer time.

Methods

getCachedToken()

Returns the cached access token, or undefined if one is not cached or the cached one is expiring soon.

setCachedToken(undefined | AccessToken)

Saves an access token into the internal in-memory cache.

Constructor Details

ExpiringAccessTokenCache(number)

Constructs an instance of ExpiringAccessTokenCache with an optional expiration buffer time.

new ExpiringAccessTokenCache(tokenRefreshBufferMs?: number)

Parameters

tokenRefreshBufferMs

number

Method Details

getCachedToken()

Returns the cached access token, or undefined if one is not cached or the cached one is expiring soon.

function getCachedToken(): undefined | AccessToken

Returns

undefined | AccessToken

setCachedToken(undefined | AccessToken)

Saves an access token into the internal in-memory cache.

function setCachedToken(accessToken: undefined | AccessToken)

Parameters

accessToken

undefined | AccessToken

Access token or undefined to clear the cache.