Salesforce OAuth Client Credentials: Fix "Authentication Failed" by Using Your My Domain Token URL

Symptoms

When configuring the Salesforce Connection Manager with the OAuth 2.0 Client Credentials (Non-Interactive) authentication method, you may notice one of the following behaviors:

  • Generate Token fails or returns an authentication error.
  • Test Connection fails even though the Connected App appears to be configured correctly.
  • OAuth authentication fails despite using a valid Client ID, Client Secret, and the Client Credentials flow being enabled.

Cause

A common cause of this issue is using the Lightning Experience URL as the OAuth Token URL.

For example, the following URL is incorrect :

https://yourcompany.lightning.force.com/services/oauth2/token

The OAuth token endpoint must use your Salesforce My Domain URL instead.

Solution

Update the Token URL in the Salesforce Connection Manager to use your Salesforce My Domain endpoint.

Correct format:

https://yourcompany.my.salesforce.com/services/oauth2/token

Replace yourcompany with your Salesforce My Domain name.

After updating the Token URL:

  1. Save the connection.
  2. Click Test Connection .

The authentication should now complete successfully.

How to Find Your Salesforce My Domain

If you are unsure of your My Domain:

  1. Sign in to Salesforce.
  2. Go to Setup .
  3. Search for My Domain in the Quick Find box.
  4. Copy the domain shown, for example:
https://yourcompany.my.salesforce.com

Use this domain when constructing the OAuth Token URL.

Additional Checks

If the issue persists, verify the following:

  • The OAuth 2.0 Client Credentials Flow is enabled in the Salesforce Connected App.
  • A Run As User has been configured for the Connected App.
  • The Client ID and Client Secret are correct.
  • The connected user has sufficient permissions to access the required Salesforce APIs.
  • The OAuth scope includes the required api scope.

Example

:cross_mark: Incorrect

https://zappysys.lightning.force.com/services/oauth2/token

:white_check_mark: Correct

https://zappysys.my.salesforce.com/services/oauth2/token

Conclusion

When using Salesforce OAuth Client Credentials authentication, always use your Salesforce My Domain (*.my.salesforce.com ) for the Token URL instead of the Lightning Experience (*.lightning.force.com ) URL. Although both domains may open the Salesforce UI, only the My Domain endpoint supports the OAuth token endpoint required for authentication.