Hi Team,
I got an error while trying to connect to the exchange token URL internally via servlet.
So basically I am first generating the JWT token using the privatekey.pem file and then hitting the exchange URL internally via servlet to generate the access token so that I can access the AEM author environment to access the resource.
String body = "client_id=" + URLEncoder.encode(clientId, "UTF-8") + "&" + "client_secret="
+ URLEncoder.encode(clientSecret, "UTF-8") + "&" + "jwt_token=" + URLEncoder.encode(jwtToken, "UTF-8");
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
outputStream.writeBytes(body);
}
try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
String inputLine;
StringBuffer stringBuffer = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
stringBuffer.append(inputLine);
}
response.getWriter().print(stringBuffer);
}
I followed the below URL but not sure what is casuing the issue. do I have to allow my cloud instance to access EXCHANGE TOKEN url?
It's working well in localhost and breaking in DEV in second try statement.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Working in Localhost and Not working DEV instance - did you check the Network tab about the error details?
Might be a Firewall or Dispatcher configuration required to pass/allow the outside domain request.
Firewall or Network Restrictions: If it's working on your local machine but not on your DEV environment, it could be due to network restrictions. Check if your DEV environment has access to the Adobe IMS URL (https://ims-na1.adobelogin.com). You might need to work with your network team to allow access.
400 error - Generally with invalid syntax - ensure the String formatted correctly (one way to try with Hardcoded string first and then change it)
I think there should not be any syntax-related error because it's working in localhost. also, I am not passing any parameter from Postman which can create an issue.
Regarding the Dispatcher, I am getting the same issue in the author's environment as well.
so it's looking like AEM Cloud is blocking the domain 'https://ims-na1.adobelogin.com.
you might need to work with Adobe Support to allow access for this domain.
Views
Replies
Total Likes
It's very weird actually, it works sometimes but sometime it gives an error.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies