refreshAuthToken()
function refreshAuthToken(args: RefreshAuthTokenRequestArgs, options?: AuthOptions): Promise<AuthTokenResponse>;
Exchanges a refresh token for a new access token using the OAuth2
refresh_token grant.
Parameters
| Parameter | Type |
|---|---|
args | RefreshAuthTokenRequestArgs |
options? | AuthOptions |
Returns
Promise<AuthTokenResponse>
The refreshed token. The response may include a new refreshToken
(rotated by the server); persist it in place of the previous one when present.
Example
const { accessToken, refreshToken } = await refreshAuthToken({
clientId: 'client-id',
clientSecret: 'client-secret',
refreshToken: storedRefreshToken,
})
Throws
CommsRequestError If the refresh fails