POST ./auth

Tags: public

It is used to authenticate a user with a username and a password

Authetication flow:

  • A request will be made to ./auth with the user's username and password. If the response is 200 OK, client will be receiving an access token.
  • If the user has two-factor authentication active for this account, the endpoint will return error 107 for the parameter tfaID. To get the tfaID a request should be made to GET ./auth/challenge in order to get the list with all the possible challenges. After the list was provided a new request will be made to POST ./auth/challenge where a challenge id (tfaID) will be initialized.
  • The request to ./auth will be remade with the following parameters: uaUserName, uaPassword, tfaID, tfaResponse
  • If in the response the user will get error 1 for the parameter uaNewPassword the user must change his password. The request to ./auth will be remade, and parameters uaNewPassword, uaNewPassword2 should be found and send in the request as well.
  • If the parameter intent is set as link then uaNewPassword and uaNewPassword2 are not mandatory.
  • If parameter tfaSave = 1 and with the acccess token the endpoint will return another token that will be valid 30 days. This new token will have to be send to the next authentication in the field tfaResponse. If the token is valid and all conditions are met, two factor authentication will not be needed in this period of valability. The token should be saved safely on the client side.

POST parameter

NameValue TypeValidationDetails
intentstringRequiredWill use auth or link with the intent to make the call
uaUserNamestringRequiredUsername
uaPasswordstringRequiredUser password
tfaOptIDintn/a2fa challenge ID
tfaResponsestringn/a2fa challenge response
tfaSaveintn/aValue 1; used in order to not use 2fa for 30 days.
uaNewPasswordstringRequiredmin_length[6]; New password
uaNewPassword2stringRequiredPassword confirmation; Should match with uaNewPassword

Validation

Error FieldError CodeError Message
uaUserName101Invalid username.
uaUserName103Account blocked. The user will be guided to contact the client services.
uaUserName104Account is restricted to certain IP addresses.
uaUserName105Account has been deleted. The user will be guided to contact the client services.
uaUserName109To many failed attempts from this IP. It is recommended to try authentication later.
uaUserName110Generic error.
uaPassword102Invalid password.
tfaOptID1072fa required. tfaID and tfaResponse fields are mandatory.
tfaResponse1082fa chalenge failed. 2fa challenge response is not correct.

Output example

{
"atToken": "actual_token_here",
"atValidUntil": "2018-06-26 00:12:03"
}

Output example with tfa

{
"atToken": "actual_token_here",
"atValidUntil": "2018-06-26 00:12:03",
"tfaToken": "actual_tfa_token_here",
"tfaValidUntil": "2018-06-26 00:12:03"
}