AEM 6.4 - Oauth 2 legged authorization | Community
Skip to main content
Level 4
Mar 19, 2019 4:49 AM UTC
Solved

AEM 6.4 - Oauth 2 legged authorization

Hi All, I am trying to implement Oauth authorization in AEM publisher for certain resources.   As per the link https://www.albinsblog.com/2017/07/exposing-resources-through-oauth-aem.html#.XJByjSIzbIW  I undestand AEM supports 3 legged Oauth. I want to try 2 legged(Client credentials) and didnt see any helping documents for the same.

Have someone already tried this. Can you please share some pointers to the same

Regards,

Anand

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
a_mn1Accepted solution
Level 4
Mar 25, 2019 11:30 AM UTC

Hello Gaurav, Confimed by checking  the bundle "OSGi Bundle for Granite OAuth Server" that only 2 grant types are supported by Adobe for token generation.

1. AUTHORIZATION_CODE

2. REFRESH_TOKEN

3. JWT_BEARER

13 replies

Employee
Apr 8, 2019 3:38 AM UTC

Hi Anand,

As discussed, currently AEM do not support the client_credentials flow and internal discussions have triggered for including but there is no short-sighted plan to support it in the near future.

Regards.

Translate
a_mn1Author
Level 4
Mar 26, 2019 4:07 AM UTC

Sure. Have already raised a ticket with Daycare

Translate
Gaurav-Behl
Level 10
Mar 25, 2019 1:56 PM UTC

If that's the case, then you may reach out to DayCare and find out the reason/next steps.

Translate
a_mn1AuthorAccepted solution
Level 4
Mar 25, 2019 11:30 AM UTC

Hello Gaurav, Confimed by checking  the bundle "OSGi Bundle for Granite OAuth Server" that only 2 grant types are supported by Adobe for token generation.

1. AUTHORIZATION_CODE

2. REFRESH_TOKEN

3. JWT_BEARER

Translate
pretzelpanda
New Participant
Aug 14, 2020 4:28 AM UTC
Hi, just a question we are trying to implement oauth2 using client_credentials, is it already supported?
Translate
a_mn1Author
Level 4
Mar 25, 2019 5:57 AM UTC

Hello Gaurav PFB the screen shot

Translate
Gaurav-Behl
Level 10
Mar 22, 2019 5:26 PM UTC

json format example-

curl --request POST \ --url 'https://YOUR_DOMAIN/oauth/token' \ --header 'content-type: application/json' \ --data '{"grant_type":"client_credentials","client_id": "YOUR_CLIENT_ID","client_secret": "YOUR_CLIENT_SECRET","audience": "YOUR_API_IDENTIFIER"}'

I don't see "POST" in your screenshot.

Translate
a_mn1Author
Level 4
Mar 22, 2019 4:57 PM UTC

After step 9  , While requesting for Access token , the post request is failing in POSTMAN. However as mentioned in the link that I have pointed out , I was able to generate the access token using curl command. So 3 legged flow is working as expected in AEM. However I tried 2 legged (client_credentials ). But got the below error.

Any pointers??  smacdonald2008​ kautuksahni​

Regards,

Anand.

Translate
Gaurav-Behl
Level 10
Mar 21, 2019 8:20 PM UTC

Could you please explain what step are you on based on the flow diagram @ Adobe Experience Manager Help | Developing OAuth Scopes in AEM

Did you pass correct parameters(grant_type, redirect_uri, client_id etc.) in POSTMAN?

Translate
a_mn1Author
Level 4
Mar 21, 2019 9:40 AM UTC

Yes. I am trying 3 legged only now. Followin the steps here: https://www.albinsblog.com/2017/05/how-to-get-basic-profile-details-of-user-through-oauth.html#.XJHdliIzbIU

Here the Receive the access token step is failing.  The post request to http://localhost:4502/oauth/token is failing from POSTMAN.

Translate
Gaurav-Behl
Level 10
Mar 20, 2019 7:01 PM UTC

Probably, you are missing required headers via POSTMAN. Make required config changes to CSRF and Sling Referrer Filter for testing via POSTMAN - allow empty headers for testing. Enable Postman Interceptor and check

Have you tested your setup with usual 3 legged config to rule out any configuration related issues?

Couple of examples --https://www.practicalaem.com/2016/02/02/using-oauth-authentication-in-aem/

https://www.practicalaem.com/2016/02/02/using-oauth-authentication-in-aem/

OAuth Server functionality in AEM - Embrace Federation and unleash your REST APIs!

Translate