Server-to-server authentication uses the OAuth 2.0 client credentials flow to allow applications to access Salesforce data without interactive user sign-in. Instead of signing in through a browser, the application uses a Consumer Key (Client ID) and Consumer Secret (Client Secret) to obtain an access token from Salesforce.
The access token is issued on behalf of a specified Salesforce user, whose permissions determine which data the application can access.
This authentication method is suitable for background services, integrations, and automated processes that require non-interactive access to Salesforce data.
To create an external client app for server-to-server authentication:
1. Sign in to Salesforce and navigate to Setup.
2. Go to Apps > External Client Apps > External Client App Manager.
3. Click New External Client App.

4. In the Basic Information section, enter the required application details. Under Distribution State, select Local.

5. In the API (Enable OAuth Settings) section, select Enable OAuth.
6. In the Callback URL field, enter a URL, such as http://localhost:56420, or another supported localhost URL.
7. Under OAuth Scopes, add Manage user data via APIs to Selected OAuth Scopes.

8. In the Flow Enablement section, select Enable Client Credentials Flow.
9. In the Security section, clear all checkboxes.

10. Click Create.
After creating the external client app, retrieve its OAuth credentials.
1. In Salesforce Setup, go 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. On the Verify Your Identity page, enter the verification code sent to your email address, then click Verify.

5. Copy and securely store the Consumer Key (Client ID) and Consumer Secret (Client Secret).

To enable the client credentials flow and specify the user on whose behalf Salesforce access tokens will be issued:
1. Open the Policies tab of your external client app and click Edit.

2. In the OAuth Policies section, configure the following settings:

3. Click Save.