Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Error Adobe I/O during access token creation

1982luca
Level 8
Level 8

Hello everyone,

 

I am building a javascript client to trigger transactional messages. I am stuck to obtain access_token with this error

{"error":"invalid_client","error_description":"missing client_id parameter"}

but I set this in the cUrl. I am using XMLHttpRequest approach and set the cUrl call in the body.

xhr.send('curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "client_secret=xxxx" -F "client_id=xxxxx" -F" jwt_token=111111111111jVENjI5NDg2NTk4MDYwREQwQTQ5NUQ2MkBBZG9iZU9yZyIsInN1YiI6IkE3MkQ1OUZBNjAwQkU3QzQwQTQ5NUM0MEB0ZWNoYWNjdC5hZG9iZS5jb20iLCJodHRwczovL2ltcy1uYTEuYWRvYmVsb2dpbi5jb20vcy9lbnRfcmVhY3Rvcl9zZGsiOnRydWUsImF1ZCI6Imh0dHBzOi8vaW1zLW5hMS5hZG9iZWxvZ2luLmNvbS9jL2ZjYzNiYjcyODkxMDRmYmViNjdlZjljZjIzMmIwZDMzIn0.rNkFXFJChuslxMJenzWbRmDdG_JFIb4lWMsRrnhbhzaUfFw01sYGEy8aqWxwm7VnZfTsd9G9_QEbatsBhXIyDLGN4-DJGCsSy6PfU7jvZfMldMmeIMHAzuQ1p1wDlaVyeW7fKMhBa4_vG4P3SVu1sdM8IvFdKhD9jx8-T6uSvAea38VfrzWJ0hkEbP03_HNUaDzVGaIChUm3_X5f3QCZlg-kPaPQt0TovK7bW2IQbXJCuBxa6O3IOrktuRyfADDoX_ebA-bqSKPiEUjFjO1DiYRrx8HLWySRBglO8t3Zw15y-uYSHEPN8lf18oTEqZBVPyAckS57eWKr7M3G2wkRsg" "https://ims-na1.adobelogin.com/ims/exchange/jwt/" ');

any idea?

Thanks 

1 Reply
devconsole
Employee
Employee

Could you let me know which API you are calling so I can check with the respective product team?

Also, do you get the same error when generating the access token directly in the Developer Console?

1982luca
Level 8
Level 8

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);

}
});