Setting up a Salesforce OAuth Connection

Published: Aug 19, 2024

Setting up a Salesforce OAuth Connection

Published: Aug 19, 2024

Salesforce connections can be configured using OAuth. A single connector can be used to connect to both a Sandbox and Production Instance.

If you’d rather watch a step-by-step demonstration, see below or click here.

Set up in Salesforce

Before adding the Salesforce connector, we need to create an app in Salesforce.

Find Salesforce Instance

  1. Log into the Salesforce environment as the user.
  2. Open Setup and search for Company Information.
  3. Locate the Instance value and save it for later.

Find Salesforce Domain Name

  1. Log into the Salesforce environment as the user.
  2. Open Setup and search for My Domain.
  3. Locate the Current My Domain URL value and save it for later.
  4. Ensure that the option under Login Policy, “Prevent login from {{url}},” is unchecked if we want to allow authentication using {{url}}.
    If we want to prevent login from {{url}}, we need to use My Domain URL in the service URL session.

Create an App in Salesforce

  1. Log into the Salesforce environment as the user.
  2. Open Setup and search for App Manager.
  3. Select New External Client App.

Apps are unique for each environment/sandbox.

  1. External Client App Name – Friendly name for the app.
  2. Contact Email – Email address for app issues/validation, and Keep Distribution State – Local
  3. Enable OAuth Settings – Box must be selected.
  4. If you are using SmartConnect.com, please enter the correct Callback URL based on your deployment/region.
    • Navigate to Connections > Create Connection > Salesforce.
    • Check the box for Use OAuth and copy the redirect URL displayed in the connection window.

Note – If you are using SmartConnect 21 on-premises, please enter the correct Callback URL. Navigate to Connections > Create Connection > Salesforce and check the box for Use OAuth and copy the redirect URL displayed in the connection window.

If you want to use multiple callback URLs, you can add them by entering the first URL on the first line and the second URL on the next line.

  1. Selected OAuth Scopes – Choose these 5 scopes.
    • Access the identity URL service (id, profile, email, address, phone)
    • Manage user data via APIs (api)
    • Manage user data via Web browsers (web)
    • Perform requests at any time (refresh_token, offline_access)
    • Access custom permissions (custom_permissions)
  1. Click Create.
  2. Go to App >> Settings Tab, click Consumer Key and Secret. If you are prompted to enter a code to verify your identity, please retrieve the code from the email address entered in Step 5.
  1. On the next screen save the Consumer Key and Consumer Secret for use later.

Also, please verify the OAuth Policies under the Policies tab and ensure that the default settings remain unchanged. If needed, you may change the refresh token policy to “Refresh Token is Valid Until Revoked” based on your business requirements. However, Salesforce generally recommends using the “Expire refresh token after a specified time” option, commonly set to 90 days, for better security.

Setting up the connector in SmartConnect

  1. Login to login.smartconnect.com.
  2. Navigate to Connections > Create Connection button (or edit an existing Salesforce connection).
  3. Select Salesforce.
  4. Sandbox/Production – Use tabs to configure Sandbox and Production connections in a single connector.
  5. Description – Friendly name for the connection.
  6. Create Tests – If selected, SmartConnect will create the necessary apex tests to promote your sandbox objects to production.
  7. Use OAuth – Check this box for OAuth authentication.
  8. Service URL –
    • Use:
      https://login.salesforce.com/services/oauth2 → for Production/Developer
      https://test.salesforce.com/services/oauth2 → for Sandbox
    • If we want to prevent login from {{url}} under My Domain, we need to use My Domain URL in the service URL session. Then, it is recommended to use your current My Domain URL instead of the older instance-based URL <instance>, where the <mydomain-url> name is found at the start of this article
      https://<mydomain-url>.salesforce.com/services/oauth2
      However, if your organization uses My Domain policies, SSO, or specific login restrictions, Salesforce may require using the organization’s My Domain URL such as: <mydomain-url>
  9. Organization Name – Read-only name of Organization (Populated after click Validate).
  10. Organization Type – Read-only Type of Organization (Populated after click Validate).
  11. OAuth Details
    • Client Id – Consumer Key from Salesforce Setup.
    • Client Secret – Consumer Secret from Salesforce Setup.
  12. Reset All Test Mappings – Reset all configured Test Class mappings to their default values.
  1. Click Validate and Allow the prompt for access.
  1. Save the Connector.
Content
Set up in Salesforce Find Salesforce Instance Find Salesforce Domain Name Create an App in Salesforce Setting up the connector in SmartConnect

Feeling stuck? Get the support and guidance you need to help you power through any data challenge

Filter Results
Content Type
Reset Filters