×

User initialization

This API checks whether a user is currently authorized in the system. If the user is logged in, the response returns their profile data — full name, email, account ID, and additional settings. Permissions and parameters are also included so the system can determine which features the user can access.
Think of this as an entry point after login — the server returns the user's profile and access rights.

How to get data

Method

GET

Request address

To get the data, use the address: https://tasks.<server_address>/backend/public/initAuth

Request parameters

  • language — user language (string), e.g., en or ru
  • timezone — user timezone in minutes (number), e.g., -180 for Moscow
 

Example request (JavaScript fetch)

fetch("https://tasks.<server_address>/backend/public/initAuth?_dc=1597911308943&language=en&timezone=-180", {
  method: "GET",
  headers: {
    "x-csrf-token": token   // previously obtained token
  },
  credentials: "include"
})
.then(response => response.json())
.then(data => {
  if (data.auth) {
    console.log("You are authorized!");
    console.log("Your profile:", data.items);
  } else {
    console.log("You are not authorized. Please log in.");
  }
});
The request must include the token in the header (x-csrf-token).

Response

If the user is authorized:
{
  "auth": true,
  "items": {
    "id": 12345,
    "name": "Ivan Ivanov",
    "email": "ivan@example.com",
    "c_fio": "Ivanov Ivan Ivanovich",
    "c_account_id": 6789
  },
  "resAccParams": {...},
  "permissionsAcc": {...},
  "parametersTemplate": {...},
  "ip": "192.168.1.100"
}
  • auth — true means the user is authorized
  • items — user profile information:
  • id — unique system ID
  • name — username
  • email — email address
  • c_fio — full name of the user
  • c_account_id— account ID the user belongs to
  • resAccParams/ permissionsAcc / parametersTemplate  — account settings and access rights
  • ip — IP address from which the user is logged in
 
If the user is not authorized:
{
  "auth": false
}
This means the token is invalid or the user has not logged in yet.
If auth=false, the user must log in again.