CommunicationTokenRefreshOptions interface
Options for auto-refreshing a Communication Token credential.
Properties
| refresh |
Indicates whether the token should be proactively renewed prior to expiry or only renew on demand. By default false. |
| token | Optional token to initialize. May be a |
| token |
Callback that returns a token acquired from the Communication Identity API. The returned token must be valid (expiration date must be in the future). Return a |
| undecodable |
Lifetime, in seconds, assumed for a returned token that cannot be decoded and carries no explicit expiry (e.g. an encrypted access token). Defaults to 600 (10 minutes). Set this to your tokens' real lifetime. It is not capped: a value larger than the token's
actual lifetime means the credential refreshes later than it should and the service will
reject the expired token. To avoid guessing, prefer returning an |
Property Details
refreshProactively
Indicates whether the token should be proactively renewed prior to expiry or only renew on demand. By default false.
refreshProactively?: boolean
Property Value
boolean
token
Optional token to initialize. May be a string or an AccessToken carrying
an explicit expiry.
token?: string | AccessToken
Property Value
string | AccessToken
tokenRefresher
Callback that returns a token acquired from the Communication Identity API. The returned token must be valid (expiration date must be in the future).
Return a string to have the expiry read from the JWT, or an AccessToken
to supply the expiry explicitly (required for encrypted access tokens that
cannot be decoded).
tokenRefresher: (abortSignal?: AbortSignalLike) => Promise<string | AccessToken>
Property Value
(abortSignal?: AbortSignalLike) => Promise<string | AccessToken>
undecodableTokenExpiryIntervalInSeconds
Lifetime, in seconds, assumed for a returned token that cannot be decoded and carries no explicit expiry (e.g. an encrypted access token). Defaults to 600 (10 minutes).
Set this to your tokens' real lifetime. It is not capped: a value larger than the token's
actual lifetime means the credential refreshes later than it should and the service will
reject the expired token. To avoid guessing, prefer returning an AccessToken with an
explicit expiresOnTimestamp (e.g. derived from the token response's expires_in).
undecodableTokenExpiryIntervalInSeconds?: number
Property Value
number