Hi devconsole,
Now I am able to get access token withXMLHttpRequest call but i still have cors issue. any idea?
const data = new FormData();
data.append("client_id", "XXX");
data.append("client_secret", "XXX");
data.append("jwt_token","AAA");
const xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.open("POST", "https://cors-anywhere.herokuapp.com/https://ims-na1.adobelogin.com/ims/exchange/jwt/");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("Access-Control-Allow-Headers","Content-Type");
xhr.setRequestHeader("Access-Control-Allow-Origin","*");
xhr.setRequestHeader("Access-Control-Allow-Methods","POST");
xhr.setRequestHeader("Cache-Control","multipart/form-data");
xhr.send(data);
let access_token= xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
const token = JSON.parse(this.responseText);
access_token=token.access_token;
console.log(access_token);
}
});