You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

REQUEST

This API is used to check the password of the current User.

The structure of API as below:

POST

/auth/check-password

HEADER

The request requires you given the Token of the user that you want to check in headers. Based on this token, the system will detect the user then check the password is correct or not. To get the Token, please refer Authenticate User for more details.

{
	"accept": "application/json",
	"X-Auth-Token": "Admin Token"
}

BODY

You have to put the ID of the Agent that you want to authenticate into the body as below:

{
  "password": "string"
}

JSON RESPONSE

There is message return as JSON format. It will return the result of API and the related information as well.

If you provide correct password, the server will return code 200 with a message as below:

{
	"success": true
}

 

If you provide the wrong password, the server will return code 200 with a message as below:

{
  	"error_type": "operation_error",
   	"success": false,
   	"error":    {
      	"message": "Incorrect password",
      	"code": 200,
      	"reason": "incorrect_password"
   	}
}

 

If you don't input anything in the body or missing any fields, It will return code 400 and message as below:

{
   "error_type": "validation_error",
   "success": false,
   "errors": [   {
      "password": ["Missing data for required field."]
   }]
}

 

If the Token wrong, it will return code 401 with a message as below:

{
 	"error_type": "unauthenticated_error",
  	"success": false,
  	"error": {
    	"message": "No header X-Auth-Token present",
    	"code": 110,
    	"reason": "auth_token_not_provided"
  	}
}

On this page:

EXAMPLE

We will know more about the API through the example below:

Request

I will call API to authenticate as Agent:

curl \
-H "X-Auth-Token: eyaskjksadkasd9.9123kjsadhkj123jhasdjajsjsdhKS.IH5uHASSJsadnbads980asTHo9dhljM" \
-X POST -d "{ \"password\": \"1234678\"}" \
"http://88.99.175.131:8000/v1/auth/check-password"
 

Response

{
	"success": true
}
  • No labels