PHP error when creating Salesforce JWT OAuth Authorization configuration

Created on 21 July 2020, about 4 years ago
Updated 16 March 2022, over 2 years ago

Problem/Motivation

Cannot save Salesforce Authorization configuration at /admin/config/salesforce/authorize/add due to PHP error:

Error: Class 'Firebase\JWT\JWT' not found in /docroot/modules/contrib/salesforce/modules/salesforce_jwt/src/Plugin/SalesforceAuthProvider/SalesforceJWTPlugin.php on line 199 #0

Full trace at end of description.

Proposed resolution

I’ll leave that to someone with better knowledge than I. However, a developer on my team pointed out line 148 of salesforce/modules/salesforce_jwt/src/Plugin/SalesforceAuthProvider/SalesforceJWTPlugin.php:

It’s unsetting the credentials with unset($this->credentials); but then it calls $this->generateAssertion() afterwards, which tries to access the credentials.

Remaining tasks

(reviews needed, tests to be written or run, documentation to be written, etc.)

User interface changes

None anticipated.

API changes

None anticipated.

Data model changes

None anticipated.

Release notes snippet

Fix PHP error when saving Salesforce Authorization JWT OAuth configuration.

Full trace

php-error #25 /docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
php-error #24 /docroot/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #23 /vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #22 /docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #21 /docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #20 /docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #19 /docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #18 /docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #17 /docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
php-error #16 /vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
php-error #15 /vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
php-error #14 /docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
php-error #13 /docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
php-error #12 /docroot/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
php-error #11 /docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
php-error #10 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
php-error #9 /docroot/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
php-error #8 /docroot/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\salesforce\Form\SalesforceAuthForm), Object(Drupal\Core\Form\FormState))
php-error #7 /docroot/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm('salesforce_auth...', Array, Object(Drupal\Core\Form\FormState))
php-error #6 /docroot/core/lib/Drupal/Core/Form/FormBuilder.php(578): Drupal\Core\Form\FormValidator->validateForm('salesforce_auth...', Array, Object(Drupal\Core\Form\FormState))
php-error #5 /docroot/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'salesforce_auth...')
php-error #4 /docroot/core/lib/Drupal/Core/Form/FormValidator.php(273): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState))
php-error #3 /docroot/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array(Array, Array)
php-error #2 [internal function]: Drupal\salesforce\Form\SalesforceAuthForm->validateForm(Array, Object(Drupal\Core\Form\FormState))
php-error #1 /docroot/modules/contrib/salesforce/src/Form/SalesforceAuthForm.php(133): Drupal\salesforce_jwt\Plugin\SalesforceAuthProvider\SalesforceJWTPlugin->validateConfigurationForm(Array, Object(Drupal\Core\Form\FormState))
php-error [20-Jul-2020 19:56:16 America/New_York] Error: Class 'Firebase\JWT\JWT' not found in /docroot/modules/contrib/salesforce/modules/salesforce_jwt/src/Plugin/SalesforceAuthProvider/SalesforceJWTPlugin.php on line 199 #0 /docroot/modules/contrib/salesforce/modules/salesforce_jwt/src/Plugin/SalesforceAuthProvider/SalesforceJWTPlugin.php(152): Drupal\salesforce_jwt\Plugin\SalesforceAuthProvider\SalesforceJWTPlugin->generateAssertion()
πŸ› Bug report
Status

Fixed

Version

4.0

Component

salesforce_jwt.module

Created by

πŸ‡ΊπŸ‡ΈUnited States byronveale

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024