refresh
Refresh the user's tokens.
Description
Exchanges a refresh token for a new pair of tokens. Resolves to an IAuthEntity with the new accessToken and refreshToken.
The refresh token is single-use and tied to the device that obtained it (the x-device-metadata fingerprint); a token used from another device fails with 400. On success the SDK stores the new tokens and calls saveFunction.
.refresh(
,
);
Parameters schema
Schema
marker(required): string
Marker of the auth provider.
example: "email"
token(required): string
Refresh token.
example: "abcdef123456"
Examples
Minimal example
const response = await AuthProvider.refresh('email', '1714557670334-cb85112d-618d-4b2a-bad5-137b19c135b9');
Example response
{
"userIdentifier": "john@example.com",
"authProviderIdentifier": "email",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX...",
"refreshToken": "1793092446625-3a5c6d0d-1e30-402c..."
}
Response schema
Schema: IAuthEntity
userIdentifier: string
User identifier (login), for example the email address.
example: "user12345"
authProviderIdentifier: string
Marker of the authentication provider.
example: "email"
accessToken: string
The access token for the user session.
example: "abcdef123456"
refreshToken: string
The refresh token for renewing the access token.
example: "ghijkl789012"