cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAC REST API: How to obtain Authorization Code using Auth URL?

0 Likes
2,767

Hello Dear SAP Community,

I am trying to implement SAC REST API functionality using Python. I am following this documentation article:

Configuring OAuth 2.0 Authorization Code Grant Workflow

https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/14cac91febef464dbb1efce20e3f1613/23ec63397cb041f4a9205...

The application will need to:

1.Request Authorization Code.
1.This must be done through the tenant Authorization URL.
2.The user must enter their SAP Analytics Cloud tenant credentials when redirected to the tenant IdP.
3.Access to the requested resources must be authorized by the user when prompted.

2.Request Access Token.
1.This must be done via the tenant Token URL.
2.The Authorization Code from step 1 is required.
3.The OAuth Client ID and Secret and must be provided as part of the request.
If OAuth authorization is successful, the returned token can be used to access the API.

However, I have a problem with getting the Authorization Code. In the App Integrations Section I have created an OAuth Client, where configured a redirect url.

When I navigate to "https://<>.authentication.eu10.hana.ondemand.com/oauth/authorize" (by clicking the button on the front-end, which calls the endpoint on the backend with the auth url). Then the login window is opened (at the end of the url stands ?SAMLRequest= is added), there I type the credentials, click Login and then the error message is shown (Uh oh. Something went amiss.)

I cannot find out how to configure the Auth URL. I have tried to add as parameters client_id and response_type, which are usually used in OAuth2.0, but it did not help (401 Response).

'https://<--->.authentication.eu10.hana.ondemand.com/oauth/authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}'

I could not also find any information (only the article from 2018, which is already outdated).

There is a lot of information how to get an access token using the token url https://<>.authentication.eu10.hana.ondemand.com/oauth/token. I have tested this one, it works but for me it is not the option, I need to allow users to login into their accounts on the SAC tenant and the request token.

Accepted Solutions (0)

Answers (1)

Answers (1)

vitran23
Active Participant
0 Likes

Have you taken a look at this documentation? My test I initially used the Basic Auth to get the token then pass that token to the API's.
https://help.sap.com/docs/SAP_ANALYTICS_CLOUD/00f68c2e08b941f081002fd3691d86a7/e4914540f5c04fd2b5b8b...

Is your goal to use the OAuth2 to authenticate uses in SAC?