Skip to main content
Luca_Lattarini
Level 9
Jan 31, 2021 2:24 PM UTC
Solved

Error ACS API

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 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Luca_Lattarini
Luca_LattariniAccepted solution
Level 9
Feb 3, 2021 4:52 AM UTC

@mmbb110Yes, I am able to retrieve acen by postman or access tokerminal. I have no issue. When I try to replicate the call in javascript code I have the mentioned issue. I tried to use  workbook-adobeio and another library as well but when I call require("request") from the js code I always get module not resolved. Currently the only way of sending curl call is to use XMLHttpRequest.

Thanks

12 replies

DavidKangni
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Feb 1, 2021 3:55 PM UTC

Contact Adobe support. They will provide you a python script to generate jwt token and you can call this script from your javascript

Translate
David Kangni
Luca_Lattarini
Level 9
Feb 3, 2021 2:42 AM UTC

Hi @DavidKangmi, I am using the jwt token has been generate in Adobe Console I/O with Curl command. By using this approach

 

const data = new FormData();

data.append("client_id", "xxxxxx");
data.append("client_secret", "xxxx");
data.append("jwt_token", "xxxxx");

const xhr = new XMLHttpRequest();
xhr.withCredentials = false;

xhr.open("POST", "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);
Translate
Level 9
Feb 3, 2021 3:15 AM UTC

@1982luc, I would recommend first trying the usual way of triggering an API call via postman, with access token generated via Adobe Io console, and required headers.

 

 

Translate
Luca_Lattarini
Luca_LattariniAuthorAccepted solution
Level 9
Feb 3, 2021 4:52 AM UTC

@mmbb110Yes, I am able to retrieve acen by postman or access tokerminal. I have no issue. When I try to replicate the call in javascript code I have the mentioned issue. I tried to use  workbook-adobeio and another library as well but when I call require("request") from the js code I always get module not resolved. Currently the only way of sending curl call is to use XMLHttpRequest.

Thanks

Translate