# How to set up a Named Credentials connection

> :::warning
The Salesforce Add-in version 1.13 has a known issue, where named credentials connections stop working after 60 days. Make sure you upgrade to the latest version.
:::

:::warning
The Salesforce Add-in version 1.13 has a known issue, where named credentials connections stop working after 60 days. Make sure you upgrade to the latest version.
:::

To set up named credentials, go through the following steps:

1. **Set up External Application in UiPath**.
   1. Access your UiPath Orchestrator account and click on **Admin** on the left-side menu.
   2. Select **External Applications** and click **Add application**.

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44584-8b588ad8-9f292d77.gif)
   3. Choose a name for your application and type it into the **Application name** field.
   4. Under **Application Type**, select **Confidential application**.
   5. Now, add the scopes necessary for the add-in. Click the **Add scopes** button, select the **Orchestrator API Access** Resource and add the following **Application Scopes**: `OR.Execution OR.Folders OR.Jobs OR.Machines OR.Queues OR.Robots`
   6. In the **Redirect URL** field, for the moment, you can fill in a random URL, such as `https://example.com`.
   7. Click **Add**. The **Application ID** will be displayed in the **External Application** window.
   8. Copy the **App Id** and **App Secret** in a notepad so that they can be used to configure Salesforce.
2. **Set up Salesforce to Connect to UiPath**.
   1. Click the **Setup** icon in the upper-right corner of the interface. A new window is displayed.
   2. In the left-side menu, select **Identity**, then go to **Auth Providers**.
   3. Click **New**.

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44673-614033e1-84b46ade.gif)
   4. In the **Provider Type** drop-down menu, select **UiPathAuthProvider**.
   5. Enter a **Name** and a **URL Suffix**.
   6. In the **Consumer Key** field, enter the **App Id** from the previous section.
   7. In the **Consumer Secret** field, enter the **App Secret** from the previous section.
   8. Leave the **Scope** field empty.
   9. In the **Token Endpoint** field, enter the following URL:
      * `https://[your-orchestrator-url]/identity_/connect/token` (for Orchestrator Cloud)
      * `https://{yourDomain}/identity/connect/token` (for Orchestrator Standalone)
   10. Select the **Include Consumer Secret in API Responses** checkbox.
   11. In the **Execute Registration As:** field, enter your username. Make sure you have sufficient permissions; a SysAdmin level user is required.

       ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44641-c639e881-72b761e1.webp)
   12. Click **Save**. A callback URL is generated. Copy it.

       ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-44508-7ae4feb7-475c0036.webp)
3. **Update Callback URL in UiPath Provider Setup**.
   1. Go to the **External Applications** screen in UiPath Orchestrator.
   2. Click the **Edit** button corresponding to the external app you created earlier.
   3. Paste the callback URL generated during [Setup](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-setup#setup) in the **Redirect URL** field and click **Save**.
4. **Named Credentials Setup**.
   1. Click the **Setup** icon in the upper-right corner of the interface. A new window is displayed.
   2. In the left-side menu, click **Security** and select **Named Credentials**.
   3. Click **New → New Legacy**.

      ![docs image](https://dev-assets.cms.uipath.com/assets/images/add-ins/add-ins-docs-image-284995-e63e4138-60785f4e.webp)
   4. Enter a **Label** and a **Name** (must be lowercase, no spaces or underscores). The **Label** and **Name** must be identical.
   5. In the **URL** field, type the following: `https://[your-orchestrator-url]`.
   6. In the **Identity Type** drop-down menu, select **Named Principal**.
   7. In the **Authentication Protocol** drop-down menu, select **OAuth 2.0**.
   8. For **Authentication Provider**, select the name of the **Auth Provider** created in previous section.
   9. In the **Scope** field, enter the following: `OR.Execution OR.Folders OR.Jobs OR.Machines OR.Queues OR.Robots`
   10. Select the **Start Authentication Flow on Save** checkbox.
   11. Select the **Generate Authorization Header** checkbox.
   12. Leave the **Allow merge Fields in HTTP Header** disabled.
   13. Select the **Allow Merge Fields in HTTP Body** checkbox.
   14. Leave the **Outbound Network Connection** field blank.
   15. Click **Save** to launch the OAuth flow to connect to UiPath. Now these **Named Credentials** can be used for your [UiPath connection](https://docs.uipath.com/add-ins/other/latest/user-guide/salesforce-connection-settings#connection-settings).
