Accepted Solutions (1)

Accepted Solutions (1)

Gaurav-Behl

MVP

29-08-2019

In your scenario,  POSTMAN is replaced by AEM to access the API endpoint, hence you may not need  -- post.setHeader("Postman-Token", "xxxx");

 

You may go through following links to set up OAuth. There are a lot of articles available on AEM-OAuth integration in this forum and on web:

https://helpx.adobe.com/experience-manager/kt/eseminars/gems/aem-oauth-server-functionality-in-aem.h...

https://aemcorner.com/adobe-granite-oauth-authentication-handler/

 

Answers (4)

Answers (4)

Gaurav-Behl

MVP

03-09-2019

Enable/Configure debug logs on "com.sunita.wpr.aem", "org.apache.http" and "org.apache.sling"  and check

Do you see this servlet/service registered and enabled in felix console?

What do you see in the browser console logs?  Use developer tools or Fiddler or any other proxy and check the headers on request/response

Check if there are any errors related to CORS/CSRF/Referrer Filter?

sunitac70336244

29-08-2019

Dear Gaurav,

 

Thanks a lot for your reply. Please see my comments in below.

 

I'm unable to understand why do you want to pass postman-token in this request.

 

My requirement is that I need all cm:title from Alfresco APIthrough post request in AEM and show in the AEM page through component.

 

In Postman I am posting request and getting response while passing below in body.

 

 

 

In Postman I am using authorization as Bearer Token.

 

I am not sure if I need to use that token "or" not in AEM. Also that token is expired in every 1 hr. I think we need that token in AEM , because the API is not public one . To get/post request for API we should use oauth token.

 

Please suggest.

 

Thanks a lot.

Gaurav-Behl

MVP

29-08-2019

I'm unable to understand why do you want to pass postman-token in this request.

For bearer token try this --   

post.setHeader("Authorization", "Bearer " + token); 

or

httpClient.DefaultRequestHeaders.Authorization =
  
new AuthenticationHeaderValue("Bearer", "Your Oauth token");

For passing json, you have already written the code to set the body/json in HttpEntity -- post.setEntity(requestEntity);