Token Management
Learn how to generate the access token by using a Refresh Token. This applies in cases where the token has either expired or has become invalid.

Step 1:Generating Access Token from Refresh Token

This can be achieved by making a POST request shown below:
1
curl -X POST {OAUTH_URL}/v1/oauth/token/{token_type}
2
--header 'Content-Type: application/json'
3
-d '{
4
"grant_type":"refresh_token",
5
"refresh_token":"064be187f42e9238122ef9d7a985c8800dff3752",
6
"client_id":"xxxxxxxxxxxxxxxxxxxxxxxxxxx",
7
"client_secret":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
8
}'
Copied!
Different variables associated with this POST request are described below:
Variables
Status
Description
token_type*
Required
user
grant_type*
Required
Grant type should be access token
refresh_token*
Required
Add the refresh token here received in Step 3
client_id*
Required
Add the client id received in Step 2
client_secret*
Required
Add the client secret received in Step 2
The response to this request will be of similar format as that of Step 3 shown below:
1
{
2
"access_token": "eysdkhsdbjbdfsNvbnRlbnQiOnsiaXNzdWVkRm9yIjoiRnJlc2h3b3JrcyIsInNjb3BlIjoiIiwiaXNzdWVkQXQiOjE1NTk4MDQ1NTAxMzYsImV4cGlyZXNBdCI6IjIwMTktMDctMDZUMDc6MDI6MzAuMTM2WiIsInRva2VuX3R5cGUiOiJDT01QQU5ZIn0sImFfdCI6ImY3ZWM1MWMyYmE0ZGNmNzY2ZWE0ZDExMTI3ZjEzZjQzZjAwZmNhsdjhfbsfdjblfs",
3
"token_type": "bearer",
4
"expires_in": 2592000,
5
"refresh_token": "sdff064be187f42e9238122ef9d7a985c8800dff3752"
6
}
Copied!
Please note that the refresh_token generated with this response will be a new refresh_token. So going forward, the client must replace the old refresh_token with the new one.

Visual representation to understand Token Management Step 1:

STEP 2: Access Token Validation

At any point, if the user wants to validate if the access_token is valid or not, the user can call the endpoint defined below:
1
curl -X GET {OAUTH_URL}/v1/oauth/token
2
-H 'Authorization: Bearer eyJ0b2tlbkNvbnRlbnQiOnsiaXNzdWVkRm9yIjoiRnJlc2h3b3JrcyIsInNjb3BlIjoiIiwiaXNzdWVkQXQiOjE1NTk4MDQ1Nzg1ODIsImV4cGlyZXNBdCI6IjIwMTktMDYtMjFUMDc6MDI6NTguNTgyWiIsInRva2VuX3R5cGUiOiJ'
3
--header 'Content-Type: application/json'
4
Copied!
Here the user will pass the bearer token (user) in the header. The response of the request will be following for success and failure case
Sucess
Failure
1
{
2
"access_token": "eyJ0b2tlbkNvbnRlbnQiOnsiaXNzdWVkRm9yIjoiRnJlc2h3b3JrcyIsInNjb3BlIjoiIiwiaXNzdWVkQXQiOjE1NTk4MDQ1Nzg1ODIsImV4cGlyZXNBdCI6IjIwMTktMDYtMjFUMDc6MDI6NTguNTgyWiIsInRva2VuX3R5cGUiOiJ",
3
"token_type": "bearer",
4
"expires_in": 1291911023
5
}
Copied!
1
{
2
"error": "invalid_request",
3
"error_description": "missing/invalid parameters authorization header"
4
}
Copied!
Last modified 2mo ago