auth
Allows you to authenticate users.
Description
It returns a Promise that resolves to an IAuthEntity object.
AuthProvider.auth(
marker*,
body*,
body.authData*,
authData.marker*,
authData.value*
);
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(required): IAuthData[]
An array of authentication data objects, each containing a marker and its corresponding value.
example:
[
{
"marker": "login",
"value": "user@example.com"
}
]
authData.marker(required): string
The marker identifying the auth field.
example: "login"
authData.value(required): string
The value of the auth field.
example: .com"
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": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX...",
"refreshToken": "1773672800707-e5f5b136-f643-4de9..."
}
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"