Setup oauth2 client for salesforce dev env for API testing using curl postman and katalon

Mar 24, 2024 | by Ralph Van Der Horst

Setup oauth2 client for Salesforce dev env for API testing using curl postman and Katalon

Creating a connected app in Salesforce and setting up the OAuth 2.0 client credentials flow for API testing involves several steps within the Salesforce platform and your application or script that will be accessing the Salesforce API.

Here’s a step-by-step guide to get you started:

Step 1:

Create a Connected App in Salesforce

Log in to Salesforce:

Go to your Salesforce instance and log in with an administrator account.

setup oauth salesforce learnautomated testing

Step 2:

Navigate to Setup:

Click on the gear icon in the upper right corner and select “Setup”.

setup oauth salesforce learnautomated testing curl

Step 3:

In the Quick Find box, search for App Manager.

setup oauth salesforce learnautomated testing

Step 4:

Click on new Connected app on the right side

setup oauth salesforce learnautomated testing

Step 5:

Fill in the necessary information:

Connected App name: Enter a name for your app

API name: will be filled automatically based on the app name.

Contact email

In the API (Enable OAuth Settings) section:

Check the Enable OAuth Settings checkbox.

Callback URL: For client credentials flow, this is not used, but Salesforce requires a value. You can enter a placeholder URL like https://localhost.

Under Selected OAuth Scopes, add the relevant scopes your application will need. Because this an environment for demo and dev purposes, you can set it too full access, which is not normally used in production scenarios for API testing

Check Use digital signatures if you are using a certificate., for this demo that is not used

setup oauth salesforce learnautomated testing

Also enable device flow and some other settings as displayed in the below screenshot

setup oauth salesforce learnautomated testing

Step 7:

Goto manage connected apps for this new created connected app

setup oauth salesforce learnautomated testing

setup oauth salesforce learnautomated testing

Now use this curl command to login

You also need to provide a policy and because we are using the client credentials flow search for your user

Now you are ready to do an api test with Salesforce

curl -X POST -H "Content-Type: application/x-www-form-urlencoded"   -d "grant_type=client_credentials&client_id=3erVG34clientid&client_secret=cliensecret"   "https://bsure-digitalbv-dev-ed.develop.my.salesforce.com/services/oauth2/token"

Once you get a bearer token (“access_token”) you can use this for any of the salesforce apis as long as they are alive.


{"access_token":"tokenbear","signature":"Udfdwerewrw=","instance_url":"https://bsure-digitalbv-dev-ed.develop.my.salesforce.com","id":"https://login.salesforce.com/id/00D7R000005GtSnUAK/0057R00000As7ZPQAZ","token_type":"Bearer","issued_at":"1711272981326"}%

For Katalon Studio I added a custom implementation which I will explain in my course in more detail in the near future https://learnautomatedtesting.com/course/katalon-and-salesforce/

by Ralph Van Der Horst

arrow right
back to blog

share this article

Relevant articles

Free Course Testautomation with Katalon Studio and Salesforce

Mar 30, 2024

Free Course Testautomation with Katalon Studio and Salesforce

Making profits with my Hobby using testautomation for trading

Mar 27, 2024

Making profits with my Hobby using testautomation for trading

Chat GPT and Testdatacreation

Mar 19, 2024

Chat GPT and Testdatacreation