SAP Knowledge Base Article - Public

2804524 - Error: "401 Unauthorized" OData Authentication Fails in First Attempt

Symptom

When you try to open the OData Collection in a browser you need to enter the credentials twice. When you try to open the OData collection in any external tools like Postman you get the below mentioned error in first attempt, in second attempt no authorization error is generated.

" 401 Unauthorized"

Environment

SAP Hybris Cloud for Customer

Reproducing the Issue

Using Browser:

  1. Open a Browser
  2. Enter the OData Collection URL for e.g.: https://myxxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codata/UserCollection
  3. It will ask for Sign In
  4. You enter the credentials
  5. It again goes back to Sign In pop up screen
  6. After entering the same credentials for the second time it works fine

 Using External Tool Postman:

  1. Go to Postman tool
  2. Enter the credentials you receive above mentioned error
  3. Entre the same credentials for the second time and Authorization passes

Cause

This may occur when you have reset the password and you are using the temporary password, you may validate the same by Login to the Cloud For Customer application.

The system will prompt you to change the password.

Resolution

Change the password and use the new credentials, you will be authorized in first attempt.

Keywords

401 unauthorized, Enter password twice, Odata authentication fail , KBA , LOD-CRM-INT-API , OData API (C4C Only) , Problem

Product

SAP Cloud for Customer core applications all versions