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

Compare with Current View Page History

« Previous Version 7 Current »

REQUEST

This API is used to check the Token of the current User. If the token correct, system will generate the new token for the user.

The structure of API as below:

POST

/auth/check-token

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 token is correct or not. 

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

 

If you call API without header, the system will return the message as below:

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

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 token, the server will return code 200 with a message as below:

{
   "success": true,
   "payload": {"token": "New Token"}
}

 

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

{
   	"error_type": "unauthenticated_error",
   	"success": false,
   	"error":    {
      	"message": "Incorrect token provided",
      	"code": 120,
      	"reason": "incorrect_token_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 "http://88.99.175.131:8000/v1/auth/check-token"
 

Response

{
   "success": true,
   "payload": {"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VkasdkqiiadsmnnadsawfQ.YlDymq9-F2VbuQZOq6SUZpuR-4iHrH4a4SNdYKklFw0"}
}
  • No labels