consuming content headless aem 6.5 oauth or token authentication | Community
Skip to main content
sreenu539
Level 7
July 12, 2024
Solved

consuming content headless aem 6.5 oauth or token authentication

  • July 12, 2024
  • 2 replies
  • 1101 views

hi,

 

We have lot of content fragments authored and used in various aem pages.

Now, the same content fragments need to be consumed in a non-aem / reactjs , webcomponents projects.

 

Is there any documentation or implementation details, links on authenticating requests from other non-aem applications to consume content fragments?

 

Thanks,

Sri

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

Hi, 

I answered a similar question recently, please check my response there: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-access-aem-api-for-outside-user/m-p/687512#M171423

 

Hope this helps

2 replies

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 12, 2024

Hi, 

I answered a similar question recently, please check my response there: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-access-aem-api-for-outside-user/m-p/687512#M171423

 

Hope this helps

Esteban Bustamante
PGURUKRISHNA
Level 4
July 15, 2024

Hi @sreenu539 

 

To authenticate requests from non-AEM applications to consume content fragments, you can use the Adobe Experience Manager Assets API. The API provides a way to access and manage content fragments programmatically.

Here is an example of how you can use the API to retrieve a content fragment:

 

json

Open In Editor
1GET /api/assets/{fragment-id}.json

 

 

You can also use the Authorization header to authenticate your requests. For example:

 

http

Open In Editor
1GET /api/assets/{fragment-id}.json 2Authorization: Bearer {access-token}
 

You can obtain an access token by using the OAuth 2.0 protocol. Adobe provides an AEM Gem session on OAuth that explains how to implement OAuth in AEM.

Additionally, you can use the Adobe Experience Manager Assets API - Content Fragments documentation to learn more about the available endpoints and parameters.

For ReactJS and WebComponents projects, you can use the API to retrieve the content fragments and then render them in your application.

Please let me know if you need more information or have any specific questions on how to implement this

sreenu539
sreenu539Author
Level 7
July 15, 2024

I am using persistent queries, assets api might not be useful for persistent query.

 

I looked at AEM Gem session, could not grasp it.

 

Is it that I create a client app on aem security services and then  

1) make a call to authorization url, to get authorization code

2) make a call to token url using authorization code to get auth token

 

then use auth token to make actual request to /graphql endpoint ?

 

Is my understanding correct? 

 

Thanks,

Sri