cancel
Showing results for 
Search instead for 
Did you mean: 

ODATA call to views in a HANADB from a Portal accessible to authorized users

Shamscharma
Participant
0 Kudos

1. We are using an ODATA service to access a view in the HANADB.

2. The users with access run a URL to execute the service.

Issue: We are able to execute the service successfully from the Chrome Browser BUT it fails when we try to do the same from Postman application. We make the call using a specific port but the system returns the message with a different port number. 

Have any of you experienced the same?

Here is the sample of the string returned by Postman:

<html><head><link rel="shortcut icon" href="data&colon;image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" /><script>document.cookie="ARFRG-??????????????????????????="+encodeURIComponent(location.hash)+";path=/";document.cookie="ARLOC-1l0yhy617qze3esdjo6gyvo590="+encodeURIComponent(location.href.split('#')[0].split(location.host)[1])+";path=/";document.cookie="signature=??????????????????????????????%3D;path=/";location="https://sapdbase.CLIENTID.com:30032/uaa-security/oauth/authorize?response_type=code&client_id=sb-Oda..."</script></head></html>

Any help would be highly appreciated.

 

  • SAP Managed Tags:

Accepted Solutions (0)

Answers (1)

Answers (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @Shamscharma,

HANA 2.0 runs applications on the Extended Application Server (XSA) which is compatible with Cloud Foundry.

An application in Cloud Foundry will only accept inbound request when there is a valid token in place. So, when you call this from your browser, you already have a session somewhere else (another tab) that gets used as means to retrieve a valid token and send it to the OData service.

When you perform the same via Postman, since you do not have a token yet, you get redirected to another page to enter your credentials. That will also happen if you try opening the same service on an Incognito Browser Session. 

Considering you are developing an API, to make the same call from Postman, you must call the oauth2 token end-point from your Hana box to retrieve a bearer token which can then be sent to your service as means for authentication. 

On the other hand, if you are developing a service that will be consumed on the XSA itself, then you must make use of SAP's App Router application (https://www.npmjs.com/package/@sap/approuter) and consolidaete all urls (service, front-end and xsuaa instance) there. App Router will perform a redirect to the identity provider of Hana for autentication and then generate a JWT token that can be forwarded to your service - all this is done automatically by the App Router.

Best regards,
Ivan