Endpoint Details: The get_access_token endpoint will be used to get the access token and the refresh token, The validity of the access token will be some minutes, and the refresh token will be days.
Method
URL
POST
URL/access/klearstack/get_access_token
Request Body
Parameters
Description
Required or Optional
username
Username of the user to be logged in
Required
password
Password of the user
Required
company_name
Name of the company for which the user is logging in
// Create a new FormData object
var data = new FormData();
data.append('username', 'Replace_User_Name_Here');
data.append('company_name', 'Replace_Company_Name_Here');
data.append('password', 'Replace_Password_Here');
// Create a new XMLHttpRequest object
var xhr = new XMLHttpRequest();
// Set up the request
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText); // Log the response
}
});
// Open the request
xhr.open("POST", "URL/access/klearstack/get_access_token");
// Set the Authorization header (if necessary)
xhr.setRequestHeader("Authorization", "Basic " + btoa("REPLACE_API_KEY:"));
// Send the request
xhr.send(data);