Skip to Content

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

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on May 11 at 07:59 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 12 at 01:55 PM

    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?providerAccount=portal

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

    Regards,

    Vamshi krishna.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.