Problem/Motivation

Hi,

I've set up the sso url and sso secret, just as in the documentation of this module and discourse, but when I try to log in from the forum, the link "http://mywebsite/discourse/sso" redirects me to a 404 page.

I made sure that the sso secret is the same in discourse settings and in the module settings on my website.

The Discourse logs seem to show that there is no answer from my website do Discourse whatsoever.

Drupal version : 8.9.2/8.9.3

Comments

Shenron_segamag created an issue. See original summary.

shenron_segamag’s picture

Component: Documentation » Code
Category: Support request » Bug report
Priority: Normal » Major
Issue summary: View changes
jurgenhaas’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Active » Needs review

I believe, the URL you need to put into your Discourse config is http://mywebsite/discourse_sso (not http://mywebsite/discourse/sso). That's how it's described in the readme file and reviewing the code, it looks like that should be the case.

shenron_segamag’s picture

Thank you. I changed to discourse_sso, and when I tried to log in from Discourse, I got the classical Drupal white error screen.

Here is the error log :

Error : Call to a member function id() on null dans Drupal\discourse_sso\Controller\DiscourseSsoController->access() (/home/segamagcxj/test/modules/contrib/discourse_sso/src/Controller/DiscourseSsoController.php ligne 64)

#0 [internal function]: Drupal\discourse_sso\Controller\DiscourseSsoController->access()
#1 /home/segamagcxj/test/core/lib/Drupal/Core/Access/CustomAccessCheck.php(75): call_user_func_array(Array, Array)
#2 [internal function]: Drupal\Core\Access\CustomAccessCheck->access(Object(Symfony\Component\Routing\Route), Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy))
#3 /home/segamagcxj/test/core/lib/Drupal/Core/Access/AccessManager.php(159): call_user_func_array(Array, Array)
#4 /home/segamagcxj/test/core/lib/Drupal/Core/Access/AccessManager.php(135): Drupal\Core\Access\AccessManager->performCheck('access_check.cu...', Object(Drupal\Component\Utility\ArgumentsResolver))
#5 /home/segamagcxj/test/core/lib/Drupal/Core/Access/AccessManager.php(112): Drupal\Core\Access\AccessManager->check(Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy), Object(Symfony\Component\HttpFoundation\Request), true)
#6 /home/segamagcxj/test/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(109): Drupal\Core\Access\AccessManager->checkRequest(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Session\AccountProxy), true)
#7 /home/segamagcxj/test/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(94): Drupal\Core\Routing\AccessAwareRouter->checkAccess(Object(Symfony\Component\HttpFoundation\Request))
#8 /home/segamagcxj/test/vendor/symfony/http-kernel/EventListener/RouterListener.php(113): Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object(Symfony\Component\HttpFoundation\Request))
#9 [internal function]: Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#10 /home/segamagcxj/test/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#11 /home/segamagcxj/test/vendor/symfony/http-kernel/HttpKernel.php(127): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object(Symfony\Component\HttpKernel\Event\GetResponseEvent))
#12 /home/segamagcxj/test/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#13 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /home/segamagcxj/test/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /home/segamagcxj/test/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /home/segamagcxj/test/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /home/segamagcxj/test/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /home/segamagcxj/test/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#22 {main}
jurgenhaas’s picture

Assigned: Unassigned » jurgenhaas
StatusFileSize
new1.29 KB

Please give this patch a try and let us know if that fixes it.

shenron_segamag’s picture

I just tried it, same white screen but different log :

Error : Call to a member function getStorage() on null dans Drupal\discourse_sso\Controller\DiscourseSsoController->validate() (/home/segamagcxj/test/modules/contrib/discourse_sso/src/Controller/DiscourseSsoController.php ligne 103)

#0 /home/segamagcxj/test/modules/contrib/discourse_sso/src/Controller/DiscourseSsoController.php(85): Drupal\discourse_sso\Controller\DiscourseSsoController->validate()
#1 [internal function]: Drupal\discourse_sso\Controller\DiscourseSsoController->discourse_sso()
#2 /home/segamagcxj/test/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#3 /home/segamagcxj/test/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#4 /home/segamagcxj/test/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#5 /home/segamagcxj/test/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#6 /home/segamagcxj/test/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#7 /home/segamagcxj/test/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#8 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#9 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#10 /home/segamagcxj/test/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#11 /home/segamagcxj/test/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /home/segamagcxj/test/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /home/segamagcxj/test/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /home/segamagcxj/test/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /home/segamagcxj/test/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#17 {main}

  • jurgenhaas committed 93e6ad0 on 2.0.x
    Issue #3161963 by jurgenhaas, Shenron_segamag: 404 when accessing sso...
jurgenhaas’s picture

I have fixed this too. Problem being that I don't have a Discourse instance at hand and neither a customer project which would still make use of it. So if anyone could jump in with such a facility, that would be really handy. Patches would be much appreciated.

shenron_segamag’s picture

I tried to log in from the discourse forum after your update, and I've been redirected to the drupal login page, and I could successfully log in through it.

But now, I'm unable to log in with another account. Even if I log out from Discourse AND from Drupal, when I try to log in with Discourse, it logs in with the previous account without opening the Drupal login page again.

I tried to login as admin with /users/admin-login, log out, and then click on "log in" again, only to be logged in with the previous account I've used.

jurgenhaas’s picture

Category: Support request » Bug report
Status: Needs review » Fixed

That's unfortunate but without an environment to test, reproduce and develop this is hard to fix. I would call this issue being fixed and suggest you open a new issue for the new problem which can then hopefully being picked up by somebody who has Discourse in action and is willing to debug and provide patch.

shenron_segamag’s picture

Sure, I'll do that. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.