Overview
The article shows the process of accessing an SAP CPI endpoint from the Postman client using OAuth 2.0 as an Authorization mechanism.
Table Of Content
Prerequisites
- Roles to design, deploy and monitor integration artifacts in SAP CI.
- An instance of Process Integration Runtime and Its Service Key.
Mocking a receiver
For the demo, I have created a simple integration flow to a mock receiver in SAP CPI. It uses an HTTPS sender adapter and a Content Modifier whose body is set to “This is a dummy receiver used for testing” ( This will be the response that we will be expecting at the end of the demo). The endpoint obtained by deploying the integration artifact looks as shown below.
Step 1: Copy the endpoint and keep it handy to use as described in further steps.
Getting new Access Token
Step 2: Open POSTMAN. Create a new request with the type GET.
Paste the endpoint copied in Step 1 into the request URL.
Under Authorization, choose Type as OAuth 2.0.
Scroll down to the ” Configure New Token ” section.
Fill in the details against the fields listed. The details can be obtained by following these (Step 10 ) steps.
Token Name: Any Valid name.
Grant Type: Client Credentials.
Access Token URL : tokenurl .
Client ID : clientId .
Client Secret: client secret.
Client Authentication: Send as Basic Auth header.
Click on Get New Access Token.
Using the OAuth 2.0 Token
Step 3: You will get the Token as below. Click on Use Token.
Token gets added to the Access Token field.
Step 4: Leave header prefix as Bearer. Click on Send.
You should get the expected response. In my case, I am getting the content set in Content Modifier as a response.
You can also select Password credentials as Grant Type in Step 2 and provide the user name and password in the respective fields. But to get the token successfully, the Password credentials must be included while creating an instance as described here.
Final Verdict
In conclusion, I hope you enjoyed reading this article on “OAuth 2.0 | Postman to SAP CPI”, If yes, then don’t forget to spread the word about it. Do send the feedback to know more about it. Signing off sudarshanpatwardhan@gmail.com