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.eyJpZCI6OCwiYXV0aFByb3ZpZGVySWRlbnRpZmllciI6ImVtYWlsIiwidXNlcklkZW50aWZpZXIiOiJ0ZXN0QHRlc3QucnUiLCJ1c2VyQWdlbnQiOiJub2RlIiwiaWF0IjoxNzUzMDkwODA0LCJleHAiOjE3NTMxMjY4MDR9.YXsaKNz0-Q9WwP-pYUKesRVcGj2IrtUNsjCsC6jf5Os",
"refreshToken": "1753090804346-336d3731-153c-4156-b194-2b877d3524cc"
}

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"