- Open in Jenkins β Open on Drupal.org βCore: 9.5.x + Environment: PHP 8.0 & MySQL 5.7 (--ignore-platform-reqs)last update
over 1 year ago 79 pass
In SalesforceAuthProviderPluginManager, both updateAuthConfig and getAuthConfig use configFactory()->getEditable rather than configFactory()->get(). This is fine if you're not overriding the authentication settings in a settings.php. If you are, however, the values from the config form rather than your settings file will be used in seeking to reauthenticate, leaving you stuck.
The patch I'll attach after creating this issue modifies these 2 functions so they use get() rather than getEditable, allowing the user to get themselves back into a usable state.
Steps to reproduce (I think I have this right - I had trouble reproducing the issue after running through the fix the first time):
1. Get a database that is already authenticated with a different token to the one you want to use (eg download a production database).
2. In a settings.php file, override the salesforce.settings keys:
$config['salesforce.settings']['consumer_key'] = '<key>';
$config['salesforce.settings']['consumer_secret'] = '<secret>';
$config['salesforce.settings']['login_url'] = '<login_url>';
3. Visit /admin/config/salesforce/authorize. You'll see the error message "Salesforce identity does not match salesforce endpoint: you need to re-authenticate.". This appears because the key and secret don't match the auth token you were using.
4. Submit the form to get Drupal to attempt to reauthorise. It should use the overridden settings, but it will actually use the form settings. This won't fix the issue and you'll be returned to step 3.
5. Apply the patch and resubmit the form. This time you'll be able to provide your site with access and start using the configuration from your overridden settings.
(If you have an IDE and set a breakpoint at line 75 of SalesforceAuthProviderPluginManager.php, you'll see it saving the form values without the patch, and the overridden settings with it applied).
Needs review
5.0
salesforce.module
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.