getUser
Getting data of an authorized user. 🔐 This method requires authorization.
Description
This method sends a request to get the data of an authorized user. It returns a Promise that resolves to an IUserEntity object.
Users.getUser(
langCode);
Parameters schema
Schema
langCode: string
Language code. Default: "en_US"
example: "en_US"
Examples
Minimal example
// 1. Authawait AuthProvider.auth("email", {
"authData": [{
"marker": "email_reg","value": "your@email.com",},
{
"marker": "password_reg","value": "yourPassword"}]});
// 2. Get userconst response = await Users.getUser();
Example response
{
"id": 8,
"identifier": "test@test.ru",
"authProviderIdentifier": "email",
"formData": [
{
"marker": "name_reg",
"type": "string",
"value": "Ivan"
},
{
"marker": "phone_reg",
"type": "string",
"value": "+19258382556"
}
],
"formIdentifier": "reg",
"groups": [
1
],
"state": {}
}
Response schema
Schema: IUserEntity
id: number
Object identifier.
example: 12345
identifier: string
Text identifier for record field.
example: "user_12345"
authProviderIdentifier: string
Text identifier of the authentication provider.
example: "auth_provider_12345"
formData: FormDataType[]
Array of data form objects with the following values.
example:
[
{
"marker": "last_name",
"type": "string",
"value": "Username"
}
]
formIdentifier: string
Text identifier of the form.
example: "form_12345"
groups: any[]
Array of user groups.
example:
[
"group_1",
"group_2"
]
state: any
Object containing additional user state information.
example:
{
"key": "value"
}