3

How to use Postman to call SuccessFactors API using OAuth authentication method...

 1 year ago
source link: https://blogs.sap.com/2023/02/02/how-to-use-postman-to-call-successfactors-api-using-oauth-authentication-method-and-sap-offline-saml-assertion-generator./
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
February 2, 2023 6 minute read

How to use Postman to call SuccessFactors API using OAuth authentication method and SAP Offline SAML Assertion generator.

How to use Postman to call SuccessFactors API using OAuth authentication method.

Introduction:

1*7Ayis4lma67IcCUsWJaI8A.png

With the upcoming removal of basic authentication on November 20, 2026, it’s important to start using OAuth as your go-to authentication method for new integration scenarios. This tutorial will guide you through the process of using OAuth authentication method on Postman, a highly valuable tool for integration development.

1*LkJnGbdfmWlGrFluMUAa_A.png

Reference: https://help.sap.com/docs/SAP_SUCCESSFACTORS_RELEASE_INFORMATION/8e0d540f96474717bbf18df51e54e522/fcc05a902b4140e585d968c2fe4a96bc.html?locale=en-US

Additionally, with Deprecation of OAuth IdP API /oauth/idp, we need to use other way to generate SAML assertions. In this tutorial we will use the SAP provided offline SAML assertion generator tool

idp.jpg

Reference:

https://launchpad.support.sap.com/#/notes/3239495

This tutorial was created by combining information from various sources and personal experiences. Let’s get started!

Prerequisites:

Familiarity with Postman, SuccessFactors, and Windows OS.

A client has been registered already in SuccessFactors:

1*r-se-3svyioBzg0UBDWOXg.png
Application registered in SuccessFactors

Step-by-Step instructions:

  1. Download Apache Maven from binary files from https://maven.apache.org/download.cgi
1*B34ElI-pu04duQSO8l4GGA.png

Once downloaded, go to your downloads folder and move the file to a more secure folder. For example, I have placed mine in a folder I created on my desktop (C:\Users\HPX360\Desktop\Tutorial).

1*8eEeiKQnThhPWYNJ5QcLXQ.png

Extract the zip file.

1*OijNLpyOjBs8wUzLVGwWVw.png

2. Download and install Java JDK.

Do a google search for “Java JDK downloads”, since the URL depends on where you’re from.

1*CLPpQXfpdAEutLwbCiPiNA.png
1*oiB_1CO6XcP04pbbnmRqcw.png

Click the Windows Tab and download the x64 Installer.

Go to your downloads folder and install it.

1*28-AelZok2pERARcWWHxXg.png

Take note of the installation folder (C:\Program Files\Java\jdk-19)

1*0ZMKcGBkAbRx7ZcowSgZzg.png

3. Set up Environment Variables on your Machine.

Use the search bar beside the windows button and search for “environment”

1*v9Xc3CRErMB6Kk8HbgAMkg.png

From the result, choose “Edit the system environment variables”

1*-IQMNLD_QSujsXReFT1oug.png

Click Environment Variables…

1*D36sLYAOxz89ITVHNW1FWg.png

Add the JAVA_HOME variable on the user and system variables by clicking the New button

1*JivzUO8vkgmSMLNjAWH5mQ.png

Variable name: JAVA_HOME

Variable value: installation folder of Java JDK you downloaded earlier.

1*rH2_Iyaw7AfxtOiSBbHyqQ.png
User Variable

Add the same values to the system variable.

1*DDWuZnUhavsecIe2_rE5Gw.png
System Variable

Add your Maven folder location to the Path variable of your machine.

To know the folder location address, in our example, we can go to the folder then right-click on the top part, and click copy address as text.

Example: C:\Users\HPX360\Desktop\Tutorial\apache-maven-3.8.7

1*MqAKuY5cPU2Jq5OgzmUsKg.png

In my machine, there is already a Path variable so I just click Edit and then click New then add the maven directory to both user and system variables.

1*RU73YNqSkWiskPs_Ahq4GQ.png

Click OK and another OK to save the variables

3. Download and extract the SAP Provided SAML Generation tool

https://launchpad.support.sap.com/#/notes/3031657

1*m_yLqwOmUoK-eRMH84CBHw.png

Save it in the tutorial folder and extract the zip file.

1*n-BKhx8G5s1pVjmcMLKGeA.png

4. Set up SAML assertion SAP offline tool.

Inside the folder you extracted earlier, open the SAMLAssertion.Properties file via the notepad editor of your choice.

1*1WZ7ZDPNA5AeS4G-6POv4A.png
1*ZakY96e9YfB1UaqmOd32Hw.png

Change the properties on the file with the ones from your SuccessFactors Tenant and save the file.

tokenUrl = https://<Tenant API URL>/oauth/token

clientID = API Key from the registered client in SuccessFactors

userId = User ID used by the registered client in SuccessFactors

userName = leave it as it is

privateKey = X.509 certificate from the registered client in SuccessFactors

1*vu7NDdUp6_mJX7yNLkMYtQ.png
Registered client in SuccessFactors
1*YpOL8glDwllmNT3S9caCEQ.png
Sample File

5. Generate SAML assertion using the SAP offline tool.

Open a command prompt from the search button then click Command Prompt App

1*HlDsrMEqWcpAtbdyHmXTsg.png
1*Twteue2L_1nIeLcl99oPVw.png

Enter cd <<folder where you extracted the SAML offline tool>> then hit Enter.

Example:

1*G__5r5SWgv9WbtZSs1oCTQ.png
Location of the SAML offline tool you downloaded earlier
1*5cZITW26GPxy5SGzQEI3hw.png
Sample command
1*ZtxuRF-lOdCPCQFUnZrBTQ.png
Once you hit enter, the current directory will change and you will see a new line like the one above.

Enter the command: mvn compile exec:java -Dexec.args=”SAMLAssertion.properties” and hit Enter

1*cgC0BNcmmsVx991yCvUazw.png
Sample Command

If all steps were setup correctly then you should get an output like the one below:

1*mW7QmEDI9-9fB0zBkmTBZg.png
Highlighted text is the generated Assertion. Copy and save it.

Copy and paste the generated Assertion on something like a notepad.

6. Postman Setup and API test call

Use the assertion we generated earlier to get the SuccessFactors token.

Make a POST request to https://<Tenant API URL>/oauth/token

Go to Body tab choose raw and enter the value company_id=<SuccessFactors Company Id>&client_id=<SuccessFactors API Key>&grant_type=urn:ietf:params:oauth:grant-type:saml2-bearer&assertion=<Assertion we generated earlier>

1*PVL-Nyh6VjZ15KH7qNgs8g.png
Sample POST request.

You will get the token as response. Copy this token.

1*kuPfjGijEqMGmB30-nuXCg.png
Token will be received from the response. Copy the token.

Create a get request. Use any API call that you usually use for testing.

Go to Headers then add “Authorization” in the Key with value:

Bearer <token we got from the POST response>

1*wRs92BLHFRE0BY5i1G2Hcg.png

Hit send to do the GET request and you will get the desired result. 🙂

1*ztOWeb7yVZOrXF6bTvQZDg.png

Remember that the assertion has an expiry and once expired you need to repeat steps #5 and 6 again.

That’s it for this tutorial! I hope you found it helpful and informative. If you have any questions or need further clarification, please feel free to ask. Your feedback is greatly appreciated! Thank you for your time! Give me an applaud below if you liked this tutorial! ☺


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK