Skip to main content

refresh

Update user tokens.

Description

This method updates the user's token. Returns an object with a set of tokens. It returns a Promise that resolves to an IAuthEntity object.

AuthProvider.refresh(

marker*, token*

);

Parameters schema

Schema

marker(required): string
The text identifier of the authorization 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": "test@test.ru",
"authProviderIdentifier": "email",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OCwiYXV0aFByb3ZpZGVySWRlbnRpZmllciI6ImVtYWlsIiwidXNlcklkZW50aWZpZXIiOiJ0ZXN0QHRlc3QucnUiLCJpYXQiOjE3Njc3NTkzNDgsImV4cCI6MTc2Nzc5NTM0OH0._Wrk4ZU1rmffbWN_mgBa_2K6yavC6O_-W1-XBPGtQtI",
"refreshToken": "1767759348848-7184d7ba-a66d-4f30-bb76-29a64696f96d"
}

Response schema

Schema: IAuthEntity

userIdentifier: string
The unique identifier for the user.
example: "user12345"

authProviderIdentifier: string
The identifier for 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"