cancel
Showing results for 
Search instead for 
Did you mean: 

How to give oAuth2.0 details in SAP UI5 application to access data from an API

former_member677692
Discoverer
0 Kudos

Hi Experts,

I would like to get the data from a rest API (SAP Cloud platform) to the UI5 application.

How to call API using oAuth2.0 details like client ID and Secret. I am able to get the data in the postman.

Also how UI5 code will generate new access token every time.

Your response will be appreciated.

Regards,

Vamshi Krishna.

Accepted Solutions (0)

Answers (1)

Answers (1)

mariusobert
Developer Advocate
Developer Advocate

Is the API another service on SAP Cloud Platform? If so, I recommend to use the Approuter as a backend proxy. The advantage of this is that the Approuter knows how to implement the OAuth flow and you only need to configure the destination.

If it's another OData service or you cannot use the Approuter for other reasons: Any backend proxy would do.

In either case: Please don't implement the OAuth flow in the UI! It's not secure to handle client ID and secret in the UI layer as this information will be public

former_member677692
Discoverer
0 Kudos

Hi Marius,

Thanks for your response.

We would like to get the all the portal service roles from cloud.

Below is the API.

https://api.us3.hana.ondemand.com/authorization/v1/accounts/xxxxxxxxxx/apps/nwc/roles?providerAccoun...

How to use Approuter as a backend proxy in my case?

Regards,

Vamshi krishna.