Okta Error Occurs When Configuring Salesforce Provisioning With PKCE
Last Updated:
Overview
When configuring Salesforce user provisioning, Okta generates a validation error and immediately closes the OAuth 2.0 authentication window if the Proof Key for Code Exchange (PKCE) configurations do not match between the two systems. Administrators resolve this issue by verifying the Salesforce External Client App parameters and ensuring the PKCE settings match the Okta application instance. During the initial setup, the OAuth 2.0 pop-up window closes immediately without displaying a login prompt, and Okta displays the following validation error:
Could not verify the Salesforce administrator credentials
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Integration Network (OIN)
- Salesforce REST API Integrations
- Provisioning
Cause
This issue occurs due to a <PKCE configuration misalignment> between Salesforce and Okta during the OAuth handshake. Salesforce strictly enforces Proof Key for Code Exchange (PKCE) validation for all ISV applications, including the Okta integration.
When attempting to enable API integration for Salesforce user provisioning within Okta, the following sequence of events occurs:
- An administrator clicks the Authenticate with Salesforce.com button in the Okta Admin Console.
- A Salesforce OAuth authentication pop-up window opens briefly.
- The pop-up closes immediately **without** displaying a login prompt or consent screen.
- The Okta Admin Console displays a validation error: "Could not verify the Salesforce administrator credentials".
- The API integration configuration settings fail to persist when the page is refreshed.
When the OAuth Consumer Key and Consumer Secret are pre-populated in the Okta configuration, Salesforce rejects the authorization request before prompting the user for authentication if any of the following mismatches exist:
1. Invalid or Stale Credentials - The Consumer Key and Consumer Secret pre-populated in Okta do not match the active credentials in the target Salesforce Connected App - The credentials may have been regenerated in Salesforce without updating Okta - The credentials may belong to a different environment (for example, sandbox vs. production)
2. Callback URL Mismatch - The Callback URL (Redirect URI) configured in the Salesforce Connected App does not exactly match the Okta org's administration domain - Common issues include: - Incorrect domain name - Mismatched protocol (http vs. https) - Extra or missing path segments - Extra trailing slashes or spaces
3. PKCE Configuration Misalignment - The "Require Proof Key for Code Exchange (PKCE)" setting in Salesforce is enabled, but the "PKCE Enabled" checkbox in Okta is unchecked (or vice versa) - This mismatch causes Salesforce to reject the authorization request, resulting in the immediate pop-up closure.
Solution
How is the Salesforce provisioning PKCE configuration error resolved?
Create or verify the Salesforce External Client App, configure the OAuth 2.0 settings, and copy the consumer credentials for the Okta integration.
- Log in to Salesforce as a System Administrator.
- Navigate to Setup > Apps > App Manager.
- Select New External Client App and provide an External Client App Name and a service account email.
- Select Edit and navigate to API (Enable OAuth Settings).
- Verify the Callback URL matches exactly:
https://system-admin.okta.com/admin/app/generic/oauth20redirect. - Verify the Selected OAuth Scopes include Manage user data via APIs (api) and Perform requests at any time (refresh_token, offline_access).
- Select the checkboxes for Require secret for Web Server Flow, Require secret for Refresh Token Flow, Require Proof Key for Code Exchange (PKCE) extension for Supported Authorization Flows, and Enable Refresh Token Rotation.
- Select Save.
- Navigate to the Policies tab and set Permitted Users to All users can self-authorize and Refresh Token Policy to Refresh token is valid until revoked.
- Navigate to the Settings tab, locate OAuth Settings, and select Consumer Key and Secret.
- Copy the Consumer Key and Consumer Secret values.
- Select Save and allow up to 10 minutes for Salesforce to replicate the security changes.
Update the Okta API integration configuration
Update the Okta application provisioning settings with the Salesforce consumer credentials and match the PKCE configuration.
- In the Okta Admin Console, navigate to Applications > Applications and select the Salesforce application.
- Select the Provisioning tab, select Integration, and select Edit.
- Clear the pre-populated values in the OAuth Consumer Key and OAuth Consumer Secret fields.
- Enter the Consumer Key and Consumer Secret copied from Salesforce.
- Select the PKCE Enabled checkbox to match the Salesforce configuration.
- Select Authenticate with Salesforce.com.
- Complete the authentication flow in the Salesforce pop-up window and select Save.
