auth
Allows you to authenticate users.
Description
This method performs user authorization. It returns a Promise that resolves to an IAuthEntity object.
AuthProvider.auth(
marker,
body
);
Parameters schema
Schema
marker(required): string
The text identifier of the authorization provider
example: "email"
body(required): IAuthPostBody
Objects contains auth information
example:
{
"authData": [
{
"marker": "login",
"value": "example@oneentry.cloud"
},
{
"marker": "password",
"value": "12345"
}
]
}
body.authData any[]
Authorization data taken from the form attached to the authorization provider
example: ""
[
{
"marker": "login",
"value": "example@oneentry.cloud"
},
{
"marker": "password",
"value": "12345"
}
]
body.authData[index].marker string
Registration form login attribute marker
example: "example@oneentry.cloud"
body.authData[index].value string
Registration form login attribute value
example: "12345"
Examples
Minimal example
const body = {
"authData": [{
"marker": "login","value": "example@oneentry.cloud"},{
"marker": "password","value":"12345"}],};
const response = await AuthProvider.auth('email', body);
Example response
{
"userIdentifier": "test@test.ru",
"authProviderIdentifier": "email",
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OCwiYXV0aFByb3ZpZGVySWRlbnRpZmllciI6ImVtYWlsIiwidXNlcklkZW50aWZpZXIiOiJ0ZXN0QHRlc3QucnUiLCJpYXQiOjE3NTkyNjQzNjEsImV4cCI6MTc1OTMwMDM2MX0.rEa9MeA540H7NYUngnlz6zPUM9G-VqoFbFkGrqy8buw",
"refreshToken": "1759264361355-493c46b6-0a99-4871-9808-9a5524eef515"
}
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"