Okta Salesforce Provisioning Fails With an Authorization Failed Error
Last Updated:
Overview
Okta fails to create a new user in Salesforce due to expired refresh tokens, mismatched Connected App policies, or incorrect credentials. Configuring the Salesforce API OAuth 2.0 settings correctly resolves this issue. Okta generates the following error during user provisioning, which displays the authorization failure details in the administrator dashboard. Review the authorization failure error message in the following image.
Push new user to external application FAILURE: "Authorization failed, unable to retrieve Access Token for salesforce".
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Salesforce
Cause
Expired or revoked refresh tokens, mismatched Connected App policies, or incorrect credentials typically cause an authorization failure or inability to retrieve an Access Token for Salesforce.
Solution
What are the correct Salesforce API OAuth settings?
Configure the Salesforce API OAuth 2.0 settings by verifying the OAuth scopes and enabling the required security options in the Salesforce administrator console.
- Verify the OAuth Scopes include
Manage user data via APIs (api)andPerform requests at any time (refresh_token, offline_access). - Navigate to the Security section.
- Select Require secret for Web Server Flow.
- Select Require secret for Refresh Token Flow.
- Select Require Proof Key for Code Exchange (PKCE) extension for Supported Authorization Flows.
- Select Enable Refresh Token Rotation.
Review the configured Salesforce OAuth scopes and security settings in the following image.
The Salesforce Integration Requires Re-Authentication in the Okta Admin Console
Copy the Salesforce Consumer Key and Secret into the Okta Provisioning Integration settings and re-authenticate the connection.
Review the Okta Provisioning Integration settings in the following image.
- Enter the Salesforce consumer key in the OAuth Consumer Key field.
- Enter the Salesforce consumer secret in the OAuth Consumer Secret field.
- Select the PKCE Enabled checkbox.
- Click Re-authenticate with Salesforce.com.
- Click Save.
Review the successful authentication confirmation in the following image.
