OAuth 2.0 (Open Authorization 2.0) is an authorization framework that allows third-party applications to access user resources without exposing user credentials.
For user-based authentication, OAuth 2.0 requires users to sign in through a browser and authorize the application’s access to their data. After authorization, the application can use a refresh token to obtain new access tokens without requiring users to sign in again.
Salesforce provides two options for configuring OAuth authentication:
To create a connected app for OAuth authentication:
1. Sign in to Salesforce and navigate to Setup.
2. In the Quick Find box, enter App Manager, then select App Manager.

3. Click New Connected App.
4. In the dialog box that opens, select Create a Connected App, then click Continue.

5. In the Basic Information section, specify the following:

6. In the API (Enable OAuth Settings) section, select Enable OAuth Settings.
7. In the Callback URL field, enter:
https://oauth.devart.com/callback/57997
Note
You can also add callback URLs with ports 58997 and 59997.
8. Under Selected OAuth Scopes, select the required permissions and click Add. Commonly used scopes include:
9. Click Save to create the connected app.
To obtain the Client ID and Client Secret:
1. In Salesforce Setup, open App Manager.
2. Locate your connected app, open its action menu, and select View.
3. Next to Consumer Key and Secret, click Manage Consumer Details.
4. Copy and securely store the Consumer Key (Client ID) and Consumer Secret (Client Secret).

To create an external client app for OAuth authentication:
1. Sign in to Salesforce and navigate to Setup.
2. Go to Apps > External Client Apps > External Client App Manager, then click New External Client App.

3. In the Basic Information section, enter the required application details.
4. In the Distribution State field, select Local.
5. In the API (Enable OAuth Settings) section, select Enable OAuth.
6. In the Callback URL field, enter:
https://oauth.devart.com/callback/57997
Note
You can also add callback URLs with ports 58997 and 59997.
7. Add the following OAuth scopes:

8. In the Flow Enablement section, select the option appropriate for your authentication scenario:
9. In the Security section, configure the settings based on the selected authentication method:
For user-based authentication:
For server-to-server authentication:

10. Click Create.
Server-to-server authentication uses the OAuth 2.0 client credentials flow to obtain an access token without interactive user sign-in. The application authenticates using its Client ID (Consumer Key) and Client Secret (Consumer Secret).
You must also specify an integration user whose permissions determine which Salesforce data the application can access.
To configure the client credentials flow:
1. Open the external client app you created.
2. Open the Policies tab and click Edit.
3. In the OAuth Policies section, select Enable Client Credentials Flow.
4. Specify the user on whose behalf access tokens will be issued.
5. Click Save.

To obtain the Client ID and Client Secret:
1. In Salesforce Setup, navigate to Apps > External Client Apps > External Client App Manager.
2. Locate and open your external client app.
3. Go to Settings > OAuth Settings > Consumer Key and Secret.
4. Copy and securely store the Consumer Key (Client ID) and Consumer Secret (Client Secret).