Get New Access Token Using Existing Refresh Token

Endpoint Name: getaccesstokenfromrefreshtoken

Request type : POST

Authorization : Bearer Token as header

Note: Please call this endpoint at certain interval before the token expiration time, 10 mins will be an appropriate amount of time as per our implementation. An expired access token can give 401 unauthorized error.

Endpoint Details: The getaccesstokenfromrefreshtoken endpoint will be used to get access token from refresh token.

Method

URL

POST

URL/access/klearstack/getaccesstokenfromrefreshtoken

Parameters

Values

Required

Description

refresh_token

string

Yes

Refresh token must be passed in request body to get new access token.

company_name

string

Yes

Name of the company for which the user is logging in.

Request Code samples

Shell

  • Request Body

curl --location "URL/access/klearstack/getaccesstokenfromrefreshtoken" \
  --header "Authorization: Bearer YOUR_EXISTING_ACCESS_TOKEN" \
  --form "refresh_token=Replace_Refresh_Token_Here" \
  --form "company_name=Replace_Company_Name_Here"

Python

  • Request Body

Java (OkHttp)

  • Request Body

Node.js (Axios)

  • Request Body

JavaScript (XHR)

  • Request Body

API Response

Status code

Example Response

200

{

"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjU2NTc2MDM4LCJpYTY1NzU5MTgsImp0aSI6IjQwMWZlYmJhODg4NDQ1MmRhN2Q3ZTA5ZjEwZmYwOWFkIiwidXNlcl9pZCI6MjZ9.sjU6iVbRRp7dTDt-l4rj7K7tKpPpaL7yskjstAUn2Zs",

"release_version": “7.8.9”

}

500

One or Many Required parameters from company name must be missing, E.g error “refresh_token”,

Last updated