# Guard: Salesforce ECA (Local) Connection Setup Steps

{% stepper %}
{% step %}

### Pre-req: get your Callback URL (redirect URI) <a href="#id-1-pre-req-get-your-callback-url-redirect-uri" id="id-1-pre-req-get-your-callback-url-redirect-uri"></a>

For AutoRABIT’s Guard ECA setup, you need **the callback URL**

Callback URL is depending on the instance:

```
{$isntancename}/oauth/_callback
```

Example:

```
https://perf.codescan.io/_codescan/oauth2/authorize
```

{% endstep %}

{% step %}

### Create the External Client App (ECA) in your Salesforce Org

1. Login into Salesforce

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FuEgVe6WmjpCb34dVyVnZ%2Fimage.png?alt=media&#x26;token=5f656167-d748-4034-9848-4d910a363a4a" alt=""><figcaption></figcaption></figure>

2. In **Salesforce**, go to **Setup**.
3. In **Quick Find**, search **External Client Apps**.
4. Open **External Client App Manager** (or the External Client Apps area).

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F4qLQvHkFr9IFeN01MR2T%2Fcdn.webp?alt=media&#x26;token=fddc17b2-a254-456f-84c3-7deb4879ca65" alt=""><figcaption></figcaption></figure>

5. Click **New External Client App**.
6. Fill in the basics:

* **Name / Label ( e.g. AR\_Local)**
* **API Name** (auto-filled)
* **Contact Email**
* **Distribution State**:
  * **Local** (only for this org)

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FcPf8TEerBcMcr6wLQysL%2Ff306f55b-5110-4872-bbec-20b722c50b29.png?alt=media&#x26;token=d4e0a10d-2eb1-4d31-ad07-7c29adca2ad8" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### &#x20;Enable OAuth + set callback URL + scopes <a href="#arm-3-enableoauthsetcallbackurlscopes" id="arm-3-enableoauthsetcallbackurlscopes"></a>

1. Click **Enable OAuth** (or expand **API (Enable OAuth Settings)** and check **Enable OAuth**).
2. Set \**Callback URL*

   The URL you collected in step 1.
3. Choose **OAuth Scopes**:
   1. Access the Identity URL service (id, profile, email, address, phone)
   2. Manage user data via APIs
   3. Manage user data via web browsers (web)
   4. Full access (full)
   5. Perform requests at any time (refresh\_token, offline\_access.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fkul6RSf3q7UzM3XAAvG8%2Fdceacf2f-02aa-4225-b825-5f36c013b167.png?alt=media&#x26;token=1bc526fe-81af-4610-a9f6-761a9a689481" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Turnment <a href="#arm-4-turnment" id="arm-4-turnment"></a>

1. In **Flow Enablement**, select **Enable Authorization Code and Credentials Flow**.
2. **user credentials are required in the POST body** (Salesforce shows this option when you choose that flow) should be disabled.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FQggg8ZOFmdgfTYvxkl1A%2F619e40a3-3cab-4c4d-a1ff-a2580e7ba452.png?alt=media&#x26;token=f570a082-0af5-4a2a-9524-95c9b2c1d333" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Security toggles (common defaults) <a href="#arm-5-securitytoggles-commondefaults" id="arm-5-securitytoggles-commondefaults"></a>

In the **Security** section the next options should be enabled:

* **Require secret for Web Server Flow**
* **Require secret for Refresh Token Flow**
  {% endstep %}

{% step %}

### &#x20;Create the app and capture Client ID / Secret <a href="#arm-6-createtheappandcaptureclientid-secret" id="arm-6-createtheappandcaptureclientid-secret"></a>

1. Click **Create**.
2. Open the app’s **Settings** tab and locate **Consumer Key and Secret**:

* **Consumer Key** = **Client ID**
* **Consumer Secret** = **Client Secret**

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FCxee44cwa9Rp76xIJE7B%2Fd27e1bed-b3fa-4eaf-8853-49349a61c8d1.png?alt=media&#x26;token=56a4e104-7307-4532-b1dc-86067684b308" alt=""><figcaption></figcaption></figure>

When you click the button for Consumer Key and Secret a code will be sent to the registered email for the user creating the configuration

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FgHA4O58MNDSOPr2LfN2W%2F5117773e-24dc-490e-bd4a-bfb39742eb18.png?alt=media&#x26;token=3d879466-1986-40db-95dd-e02e55d13f28" alt=""><figcaption></figcaption></figure>

After getting the code and verify in Salesforce the Consumer Key (CliendID) and Consumer Secret (Client Secret) will be displayed.

**IMPORTANT: STORE THIS VALUES IN A SAFE PLACE WHERE CAN BE EASILY USED FOR FUTURE REFERECES.**

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FdE4gGKjy8VhdI85RqHaS%2Fd6f4ece7-0cd4-4ae3-8c8f-bb1322d472dd.png?alt=media&#x26;token=08c11311-4f10-4021-b70c-ce8d082652b1" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Configure Policies (very important) <a href="#arm-7-configurepolicies-veryimportant" id="arm-7-configurepolicies-veryimportant"></a>

After creating the ECA, open the **Policies** tab and adjust as needed (exact options vary by org/security posture), commonly:

* **Permitted Users**: often set to **Admin approved users are pre-authorized** for controlled rollouts.
* Add the required **profiles/permission sets** (or approved users) for who is allowed to authorize.
  {% endstep %}

{% step %}

### What you’ll use in AutoRABIT <a href="#arm-8-whatyoulluseinautorabit" id="arm-8-whatyoulluseinautorabit"></a>

Once created, the set of values you’ll reference in your Guard configuration are:

* **Client ID**
* **Client Secret**

Also, the internal direction is to be clear that **one ECA per customer org** can be used across products (rather than creating one per AR product).

***

After the configuration in salesforce is complete, and you have obtained the ClientID and Client Secret, we can go to Guard to create the connection

Click in Salesforce Orgs

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FwSdr7M7OwFdWpS5Td89n%2Fcdn.webp?alt=media&#x26;token=388b1300-1835-42cc-98ac-ec40b2e37de3" alt=""><figcaption></figcaption></figure>

Click in the button Add a new Org

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FIJuG4qZlFt9Lg4UIjQAU%2Fcdn-1.webp?alt=media&#x26;token=ccb93ac9-7010-4dfb-81f5-44874fa0b450" alt=""><figcaption></figcaption></figure>

If the org that wants to be connected already has the Guard Connected App installed and active, the connected app option should be selected if not, select External Client App as the connection type and enter all the required details in the corresponding fields.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FbE9geM9fkpiGxNCSQLcm%2Fcdn-2.webp?alt=media&#x26;token=9e6cea37-1556-4c7d-a117-dffd03e31a96" alt=""><figcaption></figcaption></figure>

Once the form is completed, click on the button Login to Salesforce, and a salesforce login page is shown to login with the user we intend to use for the connection.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FUJa2o71MkufAsZO2Mpjk%2F2ee0edd6-fd45-4ca0-9114-356995ca5351.png?alt=media&#x26;token=6cf963d9-8318-4b99-9977-3333bea3a003" alt=""><figcaption></figcaption></figure>

A message from Salesforce will show to require granted permissions for the user to use the scopes defined in the ECA, Click Allow

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fc4VDWxfmyZIEacA0hPrH%2Fe6cc1945-e43c-4c68-802b-873dacaa0b2f.png?alt=media&#x26;token=72420979-a4c6-4104-bfe4-4ad88d6c5386" alt=""><figcaption></figcaption></figure>

Then, the org will be added successfully.

{% hint style="info" %}
**Important:** This setup is **Salesforce org-specific**. You must repeat this process **for each customer Salesforce org** you want to connect, since the External Client App is created inside (and scoped to) that org and produces org-specific credentials.
{% endhint %}
{% endstep %}
{% endstepper %}


---

# Agent Instructions: 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:

```
GET https://knowledgebase.autorabit.com/fundamentals/faq/salesforce-external-connected-app-eca-configuration-for-autorabit/guard-salesforce-eca-local-connection-setup-steps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
