1

I am getting below exception while accessing customer shop OCAPI to register customer or get customer profile. I have provided Oauth token for default client id as : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Request: POST https://hostname:port/dw/shop/v19_8/customers

https://documentation.b2c.commercecloud.salesforce.com/DOC1/index.jsp?topic=%2Fcom.demandware.dochelp%2FOCAPI%2Fcurrent%2Fshop%2FResources%2FCustomers.html&cp=0_12_3_5

Exception: "type": "AccessWithoutUserForbiddenException", "message": "An authenticated user is required in order to access the resource."

Could you help me with this? Any Idea or suggestion would be appreciated.

  • Post the entire request/response with any sensitive info redacted as shown in the Samples section of the doc – identigral Aug 21 at 19:14
2

You can access OCAPI Shop API resources within valid customer session OR by using Business Manager credentials. In your case you retrieved access token by using client id and client password. In order to access shop resources outside customer session you have to authenticate your request with BM username, BM password and client password.

Check this page for more details: https://documentation.b2c.commercecloud.salesforce.com/DOC1/topic/com.demandware.dochelp/OCAPI/current/usage/OAuth.html?cp=0_12_2_22

Example collection: https://github.com/velizarn/postman-ocapi-collections

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.