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.eyJpZCI6OCwiYXV0aFByb3ZpZGVySWRlbnRpZmllciI6ImVtYWlsIiwidXNlcklkZW50aWZpZXIiOiJ0ZXN0QHRlc3QucnUiLCJpYXQiOjE3NjI0MjEyNzYsImV4cCI6MTc2MjQ1NzI3Nn0.TR3Hjud_cUWR_fHyy6e_f6qs7j42-yz0cgxvLZ0ZNBI",
"refreshToken": "1762421276862-759a752c-e973-49b5-8f2a-6e24a02eb1ff"
}

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"