> For the complete documentation index, see [llms.txt](https://docs.appstrategy.com/apprules-r-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/crm/salesforce.md).

# Salesforce

By default, the connector uses the production environments. Set UseSandbox to **true** to use a Salesforce sandbox account. If you are using user/password authentication, ensure that you specify a sandbox user name in User.

## 1         Salesforce Authentication

There are several authentication methods available for connecting to Salesforce including login credentials, SSO, and OAuth.

### 1.1       Authenticating with a Login and Token

Set the AuthScheme to **Basic** and set the User and Password to your login credentials. Additionally, set the SecurityToken. By default, the SecurityToken is required, but you can make it optional by allowing a range of trusted IP addresses.

To disable the security token:

1. Log in to Salesforce and enter **Network Access** in the Quick Find box in the setup section.
2. Add your IP address to the list of trusted IP addresses.

To obtain the security token:

1. Open the personal information page on Salesforce.com.
2. Click the link to reset your security token. The token will be emailed to you.
3. Specify the security token in the SecurityToken connection property or append it to the Password.

### 1.2       Authenticating with OAuth

Set the AuthScheme to **OAuth**. If you do not have access to the user name and password or do not want to require them, use the OAuth user consent flow.

To obtain the OAuth client credentials, consumer key, and consumer secret:

1. Log in to Salesforce.com.
2. From Setup, enter **Apps** in the Quick Find box and then click the link to create an app. In the **Connected Apps** section of the resulting page, click **New**.
3. Enter a name to be displayed to users when they log in to grant permissions to your app, along with a contact Email address.
4. Click **Enable OAuth Settings** and enter a value in the **Callback URL** box. Set the Callback URL to the appRules URL (must be https).
5. Select the scope of permissions that your app should request from the user.&#x20;
6. Click your app name to open a page with information about your app. The OAuth client credentials, the consumer key, and consumer secret are displayed.

&#x20;

### 1.3       Authenticating with OAuthJWT Certificate Authentication

Set the AuthScheme to **OAuthJWT**.

#### 1.3.1     Authenticating with OAuthJWT

To obtain the OAuthJWT consumer key:

1. Log in to Salesforce.com.
2. From Setup, enter **Apps** in the Quick Find box and then click the link to create an app. In the **Connected Apps** section of the resulting page, click **New**.
3. Enter a name to be displayed to users when they log in to grant permissions to your app, along with a contact Email address.
4. Click **Enable OAuth Settings** and enter a value in the **Callback URL** box. Set this value only to create the Connected App as it is required. It will not actually be needed for this type of authentication. The Callback URL is in the format:

| `http://localhost:8019/src/oauthCallback.rst` |
| --------------------------------------------- |

1. Enable **Use digital signatures**.
2. Upload your certificate.
3. Select the scope of permissions that your app should request from the user.
4. Click your app name to open a page with information about your app. The OAuth consumer key is displayed.

After creating your OAuth Application, set the following connection properties:

* AuthScheme: Set to **OAuthJWT**.
* InitiateOAuth: Set to **GETANDREFRESH**.
* OAuthJWTCert: Set this to the JWT Certificate store.
* OAuthJWTCertType: Set this to the type of the certificate store specified by OAuthJWTCert.
* OAuthJWTCertPassword: Set this to the Password of the JWT Certificate store.
* OAuthJWTIssuer: Set this to the OAuth Client ID.
* OAuthJWTSubject: Set this to the username (email address) to the permitted User Profile configured in the OAuth Connected App.

**Note:** This flow never issues a refresh token.

### 1.4       Authenticating with AzureAD

Set the AuthScheme to **AzureAD**. The following connection properties are used to connect to AzureAD:

* SSOExchangeUrl: The Salesforce OAuth 2.0 token endpoint for the identity provider. This can be found in the Salesforce account settings by navigating to **Administration Setup > Security Controls > SAML Single Sign-On Settings** and then choosing the desired organization.

Note that this configuration requires two AAD applications: the "Salesforce" application used for single sign-on, and a separate "connector" application with user\_impersonation permission on the "Salesforce" application. You must also specify the OAuth connection properties:

* OAuthClientId: The application ID of the connector application, listed in the Overview section of the app registration.
* OAuthClientSecret: The client secret value of the connector application. Azure AD displays this when you create a new client secret.

The following SSOProperties are used to authenticate to AzureAD:

* Resource: The application ID URI of the Salesforce application, listed in the Overview section of the app registration. In most cases this is the URL of your custom Salesforce domain.
* AzureTenant: The ID of the Azure AD tenant where the applications are registered.

### 1.5       Authenticating with Okta

Set the AuthScheme to **Okta**. The following connection properties are used to connect to Okta:

* User: Set this to the Okta user.
* Password: Set this to Okta password for the user.
* SSOLoginUrl: Set this to the login url used by the SSO provider.
* SSOExchangeUrl: The Salesforce OAuth 2.0 token endpoint for the identity provider. This can be found in the Salesforce account settings by navigating to **Administration Setup > Security Controls > SAML Single Sign-On Settings** and then choosing the desired organization.

The following SSOProperties are needed to authenticate to Okta:

* APIToken (optional): Set this to the API Token that the customer created from the Okta org. It should be used when authenticating a user via a trusted application or proxy that overrides OKTA client request context.

#### 1.5.1        Authenticating with OneLogin

Set the AuthScheme to **OneLogin**. The following connection properties are used to connect to OneLogin:

* User: Set this to the OneLogin user.
* Password: Set this to OneLogin password for the user.
* SSOExchangeUrl: The Salesforce OAuth 2.0 token endpoint for the identity provider. This can be found in the Salesforce account settings by navigating to **Administration Setup > Security Controls > SAML Single Sign-On Settings** and then choosing the desired organization.

The following SSOProperties are needed to authenticate to OneLogin:

* OAuthClientId: Set to the OAuthClientId, which can be obtained by selecting **Developers > API Credentials > Credential > ClientId**.
* OAuthClientSecret: Set to the OAuthClientSecret, which can be obtained by selecting **Developers > API Credentials > Credential > ClientSecret**.
* Subdomain: Set to the subdomain of the OneLogin user accessing the SSO app. For example, if your OneLogin URL is splinkly.onelogin.com, enter splinkly as the subdomain value.
* AppId: Set to the ID of the SSO app.
* Region (optional): Set to the region your OneLogin account resides in. The OneLogin API operates in multiple regions and this property is used to find the correct domain. It can take one of the following values:
* * US (default)
  * EU

### 1.6       Authenticating with PingFederate

Set the AuthScheme to **PingFederate**. The following connection properties need to be set:

* User: Set this to the PingFederate user.
* Password: Set this to PingFederate password for the user.
* SSOLoginUrl: Set this to the login url used by the SSO provider.
* SSOExchangeUrl: The Salesforce OAuth 2.0 token endpoint for the identity provider. This can be found in the Salesforce account settings by navigating to **Administration Setup > Security Controls > SAML Single Sign-On Settings** and then choosing the desired organization.

The following SSOProperties are needed to authenticate to PingFederate:

* AuthScheme (optional): The authorization scheme to be used for the IdP endpoint. The allowed values for this IdP are None or Basic.

Additionally, you can use the following SSOProperties to configure mutual SSL authentication for SSOLoginUrl, the WS-Trust STS endpoint:

* SSLClientCert
* SSLClientCertType
* SSLClientCertSubject
* SSLClientCertPassword

### 1.7       Authenticating with ADFS

Set the AuthScheme to **ADFS**. The following connection properties need to be set:

* User: Set this to the ADFS user.
* Password: Set this to ADFS password for the user.
* SSOLoginUrl: Set this to the login url used by the SSO provider.
* SSOExchangeUrl: The Salesforce OAuth 2.0 token endpoint for the identity provider. This can be found in the Salesforce account settings by navigating to **Administration Setup > Security Controls > SAML Single Sign-On Settings** and then choosing the desired organization.

The following SSOProperties are needed to authenticate to ADFS:

* RelyingParty: This attribute is the value of the Relying Party Identifier on the ADFS server for Salesforce.

#### 1.7.1        ADFS Integrated

The ADFS Integrated flow indicates you are connecting with the **currently logged in Windows user credentials**. To use the ADFS Integrated flow, simply do not specify the User and Password, but otherwise follow the same steps in the ADFS guide above.

### 1.8       Connection Properties

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Property</td><td valign="top">Key (conn string)</td><td valign="top">Required?</td><td valign="top">Description</td></tr><tr><td valign="top">User</td><td valign="top">User</td><td valign="top">Yes*</td><td valign="top">Salesforce username (email). *Required for password auth.</td></tr><tr><td valign="top">Password</td><td valign="top">UserPassword</td><td valign="top">Yes*</td><td valign="top">Salesforce password. *Required for password auth.</td></tr><tr><td valign="top">Security Token</td><td valign="top">SecurityToken</td><td valign="top">Yes*</td><td valign="top">API security token. Obtain from Salesforce → Setup → My Personal Information → Reset Security Token.</td></tr><tr><td valign="top">OAuth Client Id</td><td valign="top">OAuthClientId</td><td valign="top">No</td><td valign="top">Connected App Client ID. Required if using a custom OAuth app.</td></tr><tr><td valign="top">OAuth Client Secret</td><td valign="top">OAuthClientSecret</td><td valign="top">No</td><td valign="top">Connected App Client Secret.</td></tr><tr><td valign="top">OAuth Access Token</td><td valign="top">OAuthAccessToken</td><td valign="top">Yes*</td><td valign="top">Pre-obtained access token. *Required for AccessToken auth scheme.</td></tr><tr><td valign="top">Auth Scheme</td><td valign="top">AuthScheme</td><td valign="top">No</td><td valign="top">OAuthRefreshToken (default) or AccessToken.</td></tr><tr><td valign="top">Instance URL</td><td valign="top">InstanceUrl</td><td valign="top">No</td><td valign="top">Salesforce instance URL (e.g. https://myorg.my.salesforce.com). Auto-detected on login.</td></tr><tr><td valign="top">API Version</td><td valign="top">ApiVersion</td><td valign="top">No</td><td valign="top">Salesforce API version, e.g. v59.0 (default).</td></tr><tr><td valign="top">Sandbox</td><td valign="top">Sandbox</td><td valign="top">No</td><td valign="top">true to connect to a sandbox org (uses test.salesforce.com).</td></tr><tr><td valign="top">Bulk Threshold</td><td valign="top">BulkThreshold</td><td valign="top">No</td><td valign="top">Row count above which Bulk API is used automatically (default: 10000).</td></tr></tbody></table>

### Minimum Connection Strings

#### Username + Password + Security Token

User=<me@example.com>;UserPassword=MyPass;SecurityToken=ABCXYZ

#### Pre-obtained Access Token

AuthScheme=AccessToken;OAuthAccessToken=00Dxx...;InstanceUrl=<https://myorg.my.salesforce.com>

*⚠️  The password key is UserPassword (not Password) — DbConnectionStringBuilder silently strips keys named "Password".*

<br>

&#x20;

&#x20;

&#x20;

&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/crm/salesforce.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
