In this section, we will discuss how to register OAuth App to call Salesforce API using Client ID / Secret rather than using your User Id / Password. Once you follow these steps below to register your Salesforce App (OAuth App), at the end you will get a Client ID (sometimes referred to as App Id) and Client Secret (or App Secret). These two pieces can be used later on to call Salesforce API using OAuth. So let's get started.
Register Salesforce App
- Login into your account and go to Setup as shown below (click on gear icon at the top right corner):
- Then in the search bar input "app" and open App Manager:
- Then click New Connected App to create a new OAuth App:
- Give your App a name and: - Enable OAuth Settings - Set callback URL to following two URLs (one in each line) https://login.salesforce.com/services/oauth2/success https://zappysys.com/oauth - Add an OAuth scope you want or simply add "Full access". - Add "Perform requests on your behalf at any time (offline_token)" scope to get a refresh token so that you don't have to re-authenticate each time requesting an access token:
- Click "Save".
Get Client Id and Client Secret for Salesforce AppOnce App is created we need to find out App Id / Secret so we can use it for API calls.
- Go to App Manager
- Find out recently created App and click View (click on the small arrow to the right)
- Once App page is loaded you can Copy Consumer Key and Consumer Secret (click on reveal to see). Also copy anyone Call back URL (We will need this for OAuth Connection > Advanced Tab > Call Back URL or Redirect URL property depending on which ZappySys Product / Driver you are using)
- That's it, you can now use these 3 pieces to ZappySys OAuth connection UI or on Salesforce Connection UI (new version with OAuth support). The above screenshot is showing where to enter these 3 pieces on New Salesforce Connection. For OAuth Connection redirect URL goes to Advanced Tab > Callback URL textbox.
(OPTIONAL) Configure Salesforce OAuth refresh token validityBy default, Salesforce Refresh Token doesn't expire once you generate. If you like to change default behavior you can follow these steps.
Using Salesforce Connection with OAuth App in SSIS / ODBC
Once you have Client ID / Secret you can use in the Salesforce Connection in SSIS Connector / ODBC Driver for salesforce like below (Only new version will have OAuth option)