# AQUILA - SalesForce Integration (Username-Password Flow)

In Salesforce, the **Username-Password Flow** is an OAuth 2.0 authentication flow where an application obtains an access token by directly sending a Salesforce username, password, and (usually) security token to Salesforce.\\

##### Important note

The Username-Password Flow is increasingly discouraged for new Salesforce integrations because it requires handling user credentials directly. For most modern integrations, the **JWT Bearer Flow** or **Client Credentials Flow** is usually preferred due to better security and easier compliance with MFA requirements.

##### How it works

The client application sends a request to Salesforce's OAuth token endpoint with:

- `grant_type=password`
- Salesforce username
- Salesforce password
- Security token (often appended to the password)
- Connected App client ID
- Connected App client secret

Salesforce validates the credentials and returns an access token if authentication succeeds.

---

Log in to your Salesforce Organization.

<p class="callout info">Note: If the salesforce dashboard interface is in classic mode change it to lighting mode. </p>

- **In the Upper Right Corner click the gear icon.**

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-02/scaled-1680-/Kyqkx6MxXwwySPOm-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-02/Kyqkx6MxXwwySPOm-image.png)

- **Select setup.**

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/scaled-1680-/W418IIogPqHkBJyB-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/W418IIogPqHkBJyB-image.png)

To find the base URL and instance URL follow the guide below.

- In quick find box, enter my domain then select my domain under Company Settings.
- Under My Domain Details copy Current My Domain URL that's your base URL and Instance URL. (Give it to Cytech Support)

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/scaled-1680-/m7aiSY2jALXJCs7S-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/m7aiSY2jALXJCs7S-image.png)

#### **Creating User**

- <span class="ph cmd">In Setup, enter <kbd class="ph userinput">Users</kbd> in the Quick Find box, then select **Users**.</span>
- <span class="ph cmd">Click **New User**.</span>

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/MILGpKWiOlMAsQSh-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/MILGpKWiOlMAsQSh-image.png)

- <span class="ph cmd">Fill out the form, and assign the System Administrator.</span>
- <span class="ph cmd">Role &gt; None Specified</span>
- <span class="ph cmd">User License &gt; Salesforce</span>
- <span class="ph cmd">Profile &gt; System Administrator</span>

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/mkrP09959VmcLFYj-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/mkrP09959VmcLFYj-image.png)

- <span class="ph cmd">Click **Save**.</span>

---

##### **Enable Allow Access to External Client App Consumer Secret via REST API**

**External Client App Setting &gt; Allow Access to External Client App Consumer Secret via REST API**

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/scaled-1680-/W4Jt6m6fQpESM3SS-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/W4Jt6m6fQpESM3SS-image.png)

##### **Enable Event log files**

**Event Monitoring Settings &gt; Generate event log files**

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/scaled-1680-/u83m9Xo4Q4t80Gbm-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-05/u83m9Xo4Q4t80Gbm-image.png)

---

#####  **Create A Connected Apps** 

For security reasons, Salesforce blocks the OAuth 2.0 Username-Password flow by default in recent releases. Prefer the JWT bearer flow. If you must use the Username-Password flow, in `OAuth and OpenID Connect Settings`, select `Allow OAuth Username-Password Flows`. For more information, see the Salesforce release note: [Username-Password OAuth flow blocked by default.](https://help.salesforce.com/s/articleView?id=release-notes.rn_security_username-password_flow_blocked_by_default.htm&language=en_US&release=244&type=5)

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/VXD6iKeRCEk6htq7-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/VXD6iKeRCEk6htq7-image.png)

- Log in to Salesforce (Lightning UI).
- From `Setup`, in `Quick Find` enter `External Client Apps` and select `Settings`. Turn on `Allow creation of connected apps`. To create a connected app, select `New Connected App`.

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/k1o1tW0E5LEV58Zy-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/k1o1tW0E5LEV58Zy-image.png)

- Fill `Basic Information`: `Connected App Name`, `API Name`, `Contact Email`.

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/IsDNcjY9IF5H6689-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/IsDNcjY9IF5H6689-image.png)

- In `API (Enable OAuth Settings)`, check `Enable OAuth Settings`.
- `Callback URL`: 
    - Web apps: your app callback (for example, `https://yourapp.example.com/callback`).
    - Not used by the JWT or Username-Password flows, but Salesforce requires a value; you can enter your instance URL.
- Select OAuth scopes: 
    - `Manage user data via APIs (api)`
    - `Perform requests at any time (refresh_token, offline_access)`
    - `Full access (full)`
    - Enable Client Credentials Flow
    - Enable Refresh Token Rotation

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/xYB3Idafcolwvx4x-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/xYB3Idafcolwvx4x-image.png)

- Click `Save`. It can take up to 10 minutes for the Connected App to propagate.
- After saving, open `Manage Consumer Details` to obtain `Consumer Key` and `Consumer Secret`.

<p class="callout info">Manage Consumer Details Appears only once so better to copy consumer key and consumer secret in a safe place. </p>

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/Vg0C8iMXaXIy0LRF-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/Vg0C8iMXaXIy0LRF-image.png)

- Then Click Manage to OAuth Policies 
    - Permitted Users &gt; All users may self-authorize
    - IP Relaxation &gt; Relax IP Restrictions
    - Refresh Token Policy &gt; Expire refresh token after "365" days

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/zRwgrFo6TSrG2YvC-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/zRwgrFo6TSrG2YvC-image.png)


---

##### **Verify if LoginEvent is enable  
in Quick find &gt; Event Manager &gt; enable all**

[![image.png](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/scaled-1680-/c3FO4fC2t5KzJ44w-image.png)](https://cytechint-docs-bookstack.s3.amazonaws.com/uploads/images/gallery/2026-06/c3FO4fC2t5KzJ44w-image.png)

---

##### Provide this to Cytech Support:

- **Username**
- **Password**
- **Consumer Key**
- **Consumer Secret**
- **Instance URL**

---

***If you need further assistance, kindly contact our support at <support@cytechint.com> for prompt assistance and guidance.***