Create Local External Client App
In the Salesforce App Manager, you can create a local external client app that supports the OAuth 2.0 client credentials or JSON Web Token (JWT) Bearer flow. Both flows let Fivetran authenticate as an integration user without an interactive login. Create the external client app in the Salesforce org you want Fivetran to access.
Prerequisites
You have permissions to create or edit External Client Apps.
You also need an active Salesforce integration user with API access and permission to read the objects and fields you want to sync. For JWT Bearer authentication, make a note of the exact Salesforce Username, which may differ from the user's email address.
Setup instructions
Generate key and certificate for JWT Bearer
If you use the Client Credentials flow or already have a matching RSA private key and X.509 certificate, skip this step.
Open a terminal on a computer with OpenSSL installed.
Go to a new, empty directory.
Run the following commands to generate the private key and public certificate:
umask 077 openssl req -x509 -newkey rsa:2048 -sha256 -nodes \ -keyout fivetran-salesforce-jwt-private.key \ -out fivetran-salesforce-jwt-public.crt \ -days 365 \ -subj '/CN=Fivetran Salesforce ECA JWT'This creates the following files:
fivetran-salesforce-jwt-private.key- an unencrypted RSA private key in PEM formatfivetran-salesforce-jwt-public.crt- a self-signed public certificate
The
umask 077command ensures that only you can read the private key. It stays in effect for the rest of your terminal session, so open a new terminal window or tab when you finish.Store
fivetran-salesforce-jwt-private.keyin a secure location and keep it out of source control.Make a note of the location of both files. You upload
fivetran-salesforce-jwt-public.crtto Salesforce when you create the app andfivetran-salesforce-jwt-private.keyto the JWT private key field in Fivetran.
You can also use a certificate issued by a certificate authority. Replace the key and certificate before the certificate expires.
Create external client app
Go to Setup.
In Quick Find, type App Manager.
Click App Manager.
In App Manager, click New External Client App.
Enter the following details:
- Label: Enter a name for the app, for example, 'Fivetran Integration'.
- API Name: Auto-filled from the label, can be edited.
- Contact Email: Enter your contact email address.
Find the Distribution State field.
Set Distribution State = Local. This makes the app a local External Client App, only usable in this org and not packageable.
In the API (Enable OAuth Settings) section, select the Enable OAuth checkbox.
Expand the OAuth Settings section.
In the Callback URL field, enter
https://fivetran.com/integrations/salesforce/oauth2/returnfor a production org orhttps://fivetran.com/integrations/salesforce_sandbox/oauth2/returnfor a sandbox org.Salesforce requires a valid callback URL even though neither the Client Credentials nor the JWT Bearer flow uses it.
In the OAuth Scopes menu, select Manage user data via APIs (api).
For JWT Bearer, in the OAuth Scopes menu, also select Perform requests at any time (refresh_token, offline_access). Salesforce requires this scope even though the JWT Bearer flow doesn't use a refresh token.
In the Flow Enablement section, select Enable Client Credentials Flow for client credentials or Enable JWT Bearer Flow for JWT Bearer.
For JWT Bearer, upload the public certificate you generated.
Enable JWT Bearer Flow is different from Issue JWT-based access tokens for named users. You don't need the latter setting for JWT Bearer authentication.
For Client Credentials only: When you enable OAuth 2.0 Client Credentials on an external client app, Salesforce requires you to select an integration user for the app. Every access token issued via the
client_credentialsfor that app acts as this integration user. Permissions are determined by both the scopes granted to the app and the profile, and the permission sets of the selected integration user.Click Create. Your local external client app now appears in the external client app manager.
Modify app policy
Open the app you created.
Go to the Policies tab.
Click Edit.
Follow the instructions for your chosen authentication method.
Client Credentials
- In the OAuth Policies section, under OAuth Flows and External Client App Enhancements, make sure Enable Client Credentials Flow is selected.
- In the Security section, clear all the checkboxes.
- Enter the integration user for the app.
- In the App Authorization section, select Relax IP restrictions in the IP Relaxation drop-down menu if needed.
- Click Save.
JWT Bearer
- Expand OAuth Policies.
- Under Plugin Policies, set Permitted Users to Admin approved users are pre-authorized.
- Under App Policies, select the profile or permission set that authorizes your integration user.
- If you selected a permission set, make sure it is assigned to the integration user.
- Click Save.
The integration user doesn't need the System Administrator profile solely to use JWT Bearer. For more information, see the JWT steps in the Salesforce external client app documentation.
The integration user's permissions determine which data Fivetran can sync. Make sure the integration user's login IP restrictions allow connections from Fivetran. App-level IP relaxation may not bypass user, profile, or organization restrictions.
Find client credentials
Open the app you created.
Click the Settings tab.
Expand the OAuth Settings section.
In the App Settings field, click Consumer Key and Secret.
Make a note of the Consumer Key. We use this as the Client ID in Fivetran. For the client credentials flow, also make a note of the Consumer Secret, which we use as the Client secret. JWT Bearer doesn't require a client secret.
You must also provide your My Domain URL for either grant type. For example,
https://MyDomainName.my.salesforce.com. Use the domain for the target org, including the sandbox domain for Salesforce Sandbox connections.Return to the Fivetran Salesforce connection setup form.