Fetching Data from SAP SuccessFactors via OData and OAuth

SAP Sep 1, 2024

In a few posts in the past, I described the integration of the SAP Data in Copilot. So, the big question was, how can it get the data from the SuccessFactors instance? In fact, it may be simple. Creating a technical user and accessing the data. That's it. But I do not want the easy thing; I want safe access because we work with susceptible data here. So, I must find a way to access it on behalf of a user. Yes, I pointed out a way to create an on-reside request about OAuth in my post about OAuth. But here, SAP will do a slightly different way to do this. So I tell you in this post the way to do this.

How to get the Data out of the System

The answer is quite simple: use OData. I'm on the MS Path; there, it is very simple: I create an AppRegistration thingy, grant access, and then I can call the system.

Requirements

Before we start, the following information must be fetched.

  • The CompanyID
  • A registered OAuth Client (in SF)
  • The private key that will be generated in SF

You will get this within the SuccesFactors instance. Please make sure that you are logged in as an administrator to get these informations.

The Process

So, In SAP SuccessFactors is a little bit more complex. Let show me the gross process of the authentication and fetching the data.

Source: here

Don't get confused about that... Let's do it step by step.

Step 1: Creating a XAML request

First, we must create an XAML Request to tell the IDP later which user we will use for the system. This will be done by making a POST call to this endpoint.

POST /oauth/idp HTTP/1.1
Host: {{identity-base-url}}
Content-Type: application/x-www-form-urlencoded
Content-Length: 2320

client_id=MzAyZGZjOTg5Y2M0YWQ2YmU3YmFjZTY4YmFjMw&user_id=sfadmin&token_url=%7B%7Bidentity-base-url%7D%7D%2Fouth%2Ftoken&private_key=

You will see some parameters in the body.

Tags