# Salesforce Salesforce Authentication

Source: https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/authentication/

The Salesforce connector signs in with the OAuth 2.0 **client credentials flow**. Qualytics presents the Client ID and Client Secret of a Salesforce app to your org's My Domain URL, and Salesforce issues a session for the app's **Run As** user. No person signs in, and no Salesforce user's password is stored in Qualytics.

## Two identities

Two things in Salesforce work together, and it helps to keep them apart:

- **The app** (an External Client App or a Connected App) is what Qualytics signs in as. Its Consumer Key and Consumer Secret are the **Client ID** and **Client Secret** you enter in Qualytics. The app decides *whether* Qualytics can sign in.
- **The Run As user** is the Salesforce user the app acts as. Every read happens with that user's access, so the user decides *what* Qualytics can see: which objects, and which fields within them.

When a container is missing an object or a field, look at the Run As user's access first, not at the app. See [Permissions](https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/permissions/).

## Set up the app in Salesforce

A Salesforce admin does this once, in Salesforce Setup.

1. Create an **External Client App**, or a **Connected App**, with OAuth enabled.
2. Add the **Manage user data via APIs (api)** OAuth scope.
3. Enable the **Client Credentials Flow** for the app.
4. In the app's OAuth policies, choose the **Run As** user for the client credentials flow. Qualytics reads as this user.
5. Give the Run As user the **API Enabled** permission and read access to the objects and fields you want to monitor, usually through a permission set. See [Access in your Salesforce org](https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/permissions/#access-in-your-salesforce-org).
6. Copy the app's **Consumer Key** and **Consumer Secret**. They go into **Client ID** and **Client Secret** in Qualytics.

> **Tip: A dedicated Run As user**
>
> Use a user that exists only for Qualytics, with a permission set that grants read access to exactly the objects you monitor. Its access is then easy to review, and changing it does not affect anyone's day-to-day work in Salesforce.

## Use the My Domain URL

Salesforce issues client credentials sessions only on your org's My Domain URL, which looks like `https://<your-domain>.my.salesforce.com`. The generic login addresses, `login.salesforce.com` and `test.salesforce.com`, do not work for this flow, and the connection test says so. Your Salesforce admin can find the My Domain URL under **My Domain** in Setup.

A sandbox has a My Domain URL of its own, so you connect a sandbox the same way, with that sandbox's URL and an app set up in the sandbox.

## What each field does

| Field | Required | What it is for |
| --- | --- | --- |
| **URL** | Yes | Your org's My Domain URL, for example `https://acme.my.salesforce.com`. |
| **Client ID** | Yes | The Consumer Key of the Salesforce app, which has the Client Credentials Flow enabled and a Run As user. |
| **Client Secret** | Yes | The app's Consumer Secret. Stored encrypted and never displayed back. |

The connection's other settings, **Objects** and **Maximum Parallel Jobs**, decide what is read and how fast. They are described with the rest of the form in [The connection form](https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/introduction/#the-connection-form).

## How the credentials are stored

The Client Secret is stored encrypted and never displayed back to you. Once saved, the field shows that a value is stored rather than the value itself.

- To change the Client Secret, enter the new one and save.
- To keep the stored Client Secret while editing anything else on the connection, leave the field empty and save.
- To change the **URL**, enter the Client Secret again as well. The secret is only ever sent to the URL it was saved with, so pointing the connection at another address takes the secret again.

The URL and the Client ID are not secrets and are shown as saved.

> **Warning: Edits apply to every datastore on the connection**
>
> Credentials belong to the connection, not to a single datastore. Changing them through [Manage Connections](https://userguide.qualytics.io/settings/connections/manage-connections/) changes them for every datastore that reuses that connection.

---

## See Also

- **Examples**

  Worked scenarios: a first connection, a short list of objects, a large object read in parallel, and a scan checked against the allowance.

  [Examples](https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/examples/)
- **Best Practices**

  Recommendations for choosing objects, sizing parallel reads, and keeping API usage low.

  [Best Practices](https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/best-practices/)
- **Permissions**

  The access the Run As user needs in Salesforce.

  [Permissions](https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/permissions/)
- **API Usage**

  How Salesforce counts what Qualytics reads against your org's daily allowance, and how to estimate a scan or profile before it runs.

  [API Usage](https://userguide.qualytics.io/source-datastore/datastore/native/salesforce/deep-dive/api-usage/)

> **Tip: Credentials from a secrets manager**
>
> Any field on this page can take its value from HashiCorp Vault or another secrets manager instead of being typed in: enable **Secrets Management** on the connection and write `${key}` in the field. See the [HashiCorp Vault](https://userguide.qualytics.io/source-datastore/datastore/deep-dive/hashicorp-vault/) pages for setup and troubleshooting.

*Last updated: November 16, 2026.*
