SAP Knowledge Base Article - Public

3727699 - Unauthorized when accessing Datasphere's ODATA API requests directly via browser

Symptom

  • OData request of SAP Datasphere is returning a "401 Unauthorized" error when accessed via a browser.
  • The user has proper permissions/roles/authorizations in SAP Datasphere.

Environment

SAP Datasphere

Reproducing the Issue

  1. Access the OData URL, for example https://<dataspher_hostname>.<region>.hcs.cloud.sap/api/v1/datasphere/consumption/catalog/spaces('<SPACE_NAME>')/assets.
  2. Observe the error message "401 Unauthorized" displayed in the browser.

Resolution

As highlighted in SAP Datasphere Help page Consume Data via the OData API:

"If your SAP Datasphere tenant is included in an SAP Business Data Cloud formation or is used as data storage for planning by an SAP Analytics Cloud tenant, then this URL is not accessible via Web browser without an explicit OAuth authentication."

When Datasphere is included in a BDC formation or in a Seamless Planning scenario, there is a proxy which forces the OAuth authentication for the OData API requests.
Therefore it will no longer work using the requests directly via browser using user's session.

In this new scenario, create a Datasphere's OAuth Client for the proper ODATA consumption (using Postman/Bruno or any other software which manages API calls).
The supported OAuth client scenarios are detailed in KBA 3318090 - Authentication error using SAP Datasphere OData API:

  • Interactive Usage + Authorization Code;
  • API Access + SAML2.0 Bearer;
    Note! API Access + Client Credentials is NOT supported.
  • Technical User;

See Also

Refer to: SAP Datasphere API prerequisites.  

Refer to: Using SAP Datasphere consumption APIs in SAP Build.  

Refer to: Integrating with SAP Datasphere consumption APIs using SAML bearer.  

Refer to: 3318090: Authentication error using SAP Datasphere OData API.

Keywords

odata service, unauthorized error, datasphere, 401 error, browser access, system owner, api authentication, datasphere API, consumption catalog, SDM space, authentication failure, odata troubleshooting, API access error, datasphere unauthorized, API error , KBA , DS-BB-ODATA , To address issues related to Odata consumption API , Known Error

Product

SAP Datasphere all versions