Prerequisites

You have to pass X-CSRF token, x-sap-sac-custom-auth=true parameter, and the access token to authorize your client application while sending any request to the API.

Follow the steps below:

  1. Create a new OAuth client. Follow the steps in the topic Managing OAuth Clients to create a new OAuth client.
  2. Authorize the OAuth client. Follow the steps in the section Authorization for API access OAuth Clients of the topic Managing OAuth Clients to authorize the OAuth client.
  3. Add the X-CSRF token.
    1. Issue a GET request to the API endpoint. Example endpoint: https://<your-SAC-system>.<region>.sapanalytics.cloud/api/v1/csrf
      You must include the following headers with your GET request:
      • Authorization: Bearer <Access_Token>
      • x-sap-sac-custom-auth: true
      • x-csrf-token: fetch
    2. Retrieve the value of the HTTP response header named x-csrf-token.
  4. In an HTTP request that you make to the API, add the following:
    • Authorization: Bearer <Access_Token>
    • x-sap-sac-custom-auth: true
    • x-csrf-token: <x-csrf_Token_Value>

Alternatively, you can also follow the Configuring OAuth 2.0 Authorization Code Grant workflow for authorization. After following the steps for authorization code grant, you've to generate an x-csrf-token. You can follow the step 3 mentioned above and eliminate the x-sap-sac-custom-auth parameter to generate an x-csrf-token for authorization code grant workflow. However, you would require x-csrf token only if you're sending POST, PATCH, UPDATE, and DELETE requests.

If you choose OAuth 2.0 Authorization Code Grant, then you have to pass the following parameters in your request:
  • Authorization: Bearer <Access_Token>
  • x-csrf-token: <x-csrf_Token_Value>