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
Try it live
Run this method interactively in the JS SDK sandbox — connect your Project URL and App Token on first visit, then open any scenario below to see real authentication flows:
- Update user — authenticate, then update the user's profile fields.
- Order history — authenticate the user, then fetch their personal order history.
- Order pay — authenticate before placing and paying for an order.
- Order subscription — authenticate, then check for an active subscription.
- Tickets order — authenticate as part of the tickets checkout flow.
- Guest order — log in as a guest before placing an order.
- Password reset — sign back in right after the user changes their password.
- Register user — authenticate immediately after sign-up.
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": "1776262769878-0ef81b3a-6d47-49d8..."
}
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"