# auth
Description: authorize the current connection.
The command is used for authenticating in multiple control modes for each type of protection.
Query example (Unprotected authorization):
{
"method" : "auth",
"requestId" : "1",
"type" : "unsecured",
"role" : "admin"
}
Query example (Secured authorization):
{
"method" : "auth",
"requestId" : "1",
"type" : "secured",
"credentials" : "some very secret string",
"role" : "user"
}
Query example (Status change from administrator to user):
{
"method" : "auth",
"requestId" : "1",
"role" : "user"
}
Response example:
{
"method": "auth",
"requestId" : "1",
"previleges": 2,
"token": "1*Cwk7m2fznHFi0t02*99235446*4145443734323733424642364342343533393737393543374636333936383238",
"tokenForHttpServer": "4*MKYl5cDyBcJrKUez*96643746*4139444242343336304535343243323846374130304337424641464139394633",
"result": true,
"resultCode" : 0
}
Parameter description:
type- type of authentication. Depending on the authentication type, the parameter accepts the following values:Secure authorization- the value must besecured, it can be by password, by pin, and by token. In such cases, the corresponding pin, password, or token should be specified in thecredentialsparameter.Unsecured authorization— the parameter is present and the value will be equal tounsecuredStatus change from administrator to user— is not included
role- purpose. Depending on the type of authorization, the parameter accepts the following values:Secured authorization,Unsecured authorization- optional parameter. If present, it specifies the resulting connection mode (adminoruser) and serves as its verification. If the parameter is not provided, then the mode will be assigned automatically and without verification.Status change from administrator to user— required and must be equal toadmin
credentials- depending on the type of authentication, it contains a password, PIN, or tokenresultCode- the authorization result, takes the following numerical values:0— Successful1— Internal failure2- authorization error because the current plan is notPro3- authorization error due to the current connection not being authenticated as anadministrator4- authorization error due to the fact that this type of security cannot be used according to the current authentication credentials5- authorization error due to receiving privileges different from the required ones after authorization6- authorization is unavailable due to frequent incorrect password entries. You must wait before attempting to log in again.7- authorization error due to empty credentials8- authorization error due to incorrect credentials9- authentication error due to an invalidrolefield value10- authorization error due to an invalid value in thetypefield11- authorization error due to the absence of thetypeparameter12- authorization error due to missingcredentialsparameter
previleges— the resulting management mode. The following options are possible:1—user2—administrator
token— the token of the current connection that should be used in the API. It may be used fortoken authorizationwhen the connection is lost and a new connection is established. The token lifetime depends on the type of authorization:Unsecured authorization— 30 days or until the moment when the application is closedwith a password— 30 days or until the moment when the application is closedwith a PIN— 30 days or until the moment when the application is closedwith a PIN entered from the command line— until the moment when the application is closedvia token- determined by the initial authorization during which it was obtainedSwitching to user from under administrator- is determined by the initial authorization during which it was acquired
tokenForHttpServer— the current connection token. It will be used on the HTTP server. The token lifetime equals 5 minutes or until the moment when the application is closedoverlayHttpToken- a token for use on the HTTP server within the overlay functionality. The token remains valid until the authorization data changes (setAuthParams), until logout, or until the start or end of a call or group conference.requestId- a unique request identifier. You can learn more about it here.
See also: