Authorization, obtaining a token

This section will cover the methods required for authorization and subsequent work with Callaba Engine.

Callaba Engine uses JWT as authorization mechanism.

Log in
Expand
POST
/api/auth/login

Authorizes to the API. Upon successful completion, returns the token by which all other methods are executed.

If you are using a cookie, the token will also be available in USER_STORE_TOKEN

Query parameters
email
string | required

email - username or email address. 

password
string | required

password - generated automatically after the instance is launched and represents the instance ID.

Log in
cURL
curl -X 'POST' \
'https://1.2.3.4/api/auth/login/' \
-H 'accept: appication/json' \
-H 'Content-Type: application/json' \
-d '{
"email": "admin",
"password": "password"
}'
Response
Response: Log in
JSON
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyMGJlYjA2MTM3YmIzMDAyYzhmNjAwYSIsImlhdCI6MTY0NzM2Mjg2MywiZXhwIjoxNjQ5OTU0ODYzfQ.B6V1D4Q3gV_AfJGld2z6oXmgespIR6ZYTJb_R6FNUj4",
}
Getting the token
Expand
POST
/api/auth/getToken

Get the token of the active session

Query parameters
This method has no parameters
Getting the token
cURL
curl -X 'POST' \
'http://1.2.3.4/api/auth/getToken/' \
-H 'accept: appication/json' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyMGJlYjA2MTM3YmIzMDAyYzhmNjAwYSIsImlhdCI6MTY0NzM2NDM3NSwiZXhwIjoxNjQ5OTU2Mzc1fQ.gScR-FPsfmsFvFW59eCH4-jThF2qcZ-2QYKwlN_wswE' \
-d ''
Response
Response: Getting the token
JSON
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyMGJlYjA2MTM3YmIzMDAyYzhmNjAwYSIsImlhdCI6MTY0NzM2Mjg2MywiZXhwIjoxNjQ5OTU0ODYzfQ.B6V1D4Q3gV_AfJGld2z6oXmgespIR6ZYTJb_R6FNUj4",
}
Log out
Expand
POST
/api/auth/logout

Ending a user session.

Query parameters
This method has no parameters
Log out
cURL
curl -X 'POST' \
'http://localhost/api/auth/logout/' \
-H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyMGJlYjA2MTM3YmIzMDAyYzhmNjAwYSIsImlhdCI6MTY0NzM2NDM3NSwiZXhwIjoxNjQ5OTU2Mzc1fQ.gScR-FPsfmsFvFW59eCH4-jThF2qcZ-2QYKwlN_wswE' \
-H 'accept: appication/json' \
-d ''
Response
Response: Log out
JSON
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYyMGJlYjA2MTM3YmIzMDAyYzhmNjAwYSIsImlhdCI6MTY0NzM2Mjg2MywiZXhwIjoxNjQ5OTU0ODYzfQ.B6V1D4Q3gV_AfJGld2z6oXmgespIR6ZYTJb_R6FNUj4",
}