Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

AEM+Hybris integration - OAuthHandler - authentication failed

Avatar

Level 2

Hi Friends,
I have tried the AEM + Hybris integration(out of box), I have followed all the steps from docs.adobe.com. when I am trying to import catalog from hybris, I am getting the following error in AEM error logs,
22.02.2016 16:07:40.017 *INFO* [0:0:0:0:0:0:0:1 [1456137459912] POST /libs/commerce/products HTTP/1.1] com.adobe.granite.repository Service [3438, [java.lang.Runnable]] ServiceEvent REGISTERED
22.02.2016 16:07:40.044 *INFO* [0:0:0:0:0:0:0:1 [1456137459912] POST /libs/commerce/products HTTP/1.1] com.adobe.cq.commerce.hybris.importer.DefaultHybrisImporter A /etc/commerce/products/outdoors/outdoors/en
22.02.2016 16:07:40.056 *ERROR* [0:0:0:0:0:0:0:1 [1456137459912] POST /libs/commerce/products HTTP/1.1] com.adobe.cq.commerce.hybris.impl. Server did not respond with 2xx -> authentication failed.
22.02.2016 16:07:40.072 *ERROR* [0:0:0:0:0:0:0:1 [1456137459912] POST /libs/commerce/products HTTP/1.1] com.adobe.cq.commerce.hybris.impl.OAuthHandler Server responded with 400 -> authentication failed.
22.02.2016 16:07:40.075 *ERROR* [0:0:0:0:0:0:0:1 [1456137459912] POST /libs/commerce/products HTTP/1.1] com.adobe.cq.commerce.hybris.importer.DefaultHybrisImporter Importing catalog "outdoors" from Hybris failed: 
java.lang.NullPointerException: null
at com.adobe.cq.commerce.hybris.impl.OAuthHandler.authenticateSession(OAuthHandler.java:208)
at com.adobe.cq.commerce.hybris.impl.OAuthHandler.executeAuthenticated(OAuthHandler.java:457)
at com.adobe.cq.commerce.hybris.common.DefaultHybrisConnection.execute(DefaultHybrisConnection.java:167)
at com.adobe.cq.commerce.hybris.importer.DefaultHybrisImporter.importProducts(DefaultHybrisImporter.java:403)
at com.adobe.cq.commerce.hybris.importer.DefaultHybrisImporter.importCatalog(DefaultHybrisImporter.java:197)
at com.adobe.cq.commerce.hybris.importer.DefaultHybrisImporter.doImport(DefaultHybrisImporter.java:236)
at com.adobe.cq.commerce.pim.common.AbstractImporter.run(AbstractImporter.java:167)
Please help..

1 Accepted Solution

Avatar

Correct answer by
Level 9

Well,

The Hybris server may be up and this AEM request is not allowed by your server. The Server treats this request as bad request. Does the server have any firewall in place which prevents AEM request to complete?

You could check server admin also.

---

Jitendra

View solution in original post

7 Replies

Avatar

Level 9

Based on logs information. I would suggest to verify following things:

  • Hybris server is running or not. THIS SEEMS THE ROOT CAUSE
  • Hybris connector configuration is done rightly on AEM. Specially check password again.

----

jitendra

Avatar

Level 2

Hybris server is running..I am able to access the hybris server.. Passowrd also correctly given..

Avatar

Correct answer by
Level 9

Well,

The Hybris server may be up and this AEM request is not allowed by your server. The Server treats this request as bad request. Does the server have any firewall in place which prevents AEM request to complete?

You could check server admin also.

---

Jitendra

Avatar

Level 2

Thanks for your reply Jitendra.. Both AEM server and Hybris server are running in the same machine..  I hope there is no chance of firewall coming into picture..

Avatar

Level 9

hmmm. That's interesting.

----Jitendra

Avatar

Level 1

Hi, Please install hybris OCC version i was facing the same issue but after installing hybris 5.7 OCC version oath handler works because OCC version has OATH handler in it.

To make hybris OCC version just add ycommercewebservice extension and build ur system again.

Hope this helps

Avatar

Level 1

The issue is due to hybris not exposing the token on correct url ,generally in older version of hybris the token is exposed on below url 

https://localhost:9002/rest/oauth/token

But in newer implementation they have changed the url to below

https://localhost:9002/authorizationserver/oauth/token

One option is to create a redirect filter in hybris which redirect /rest/oauth/token to /authorizationserver/oauth/token