Hello,
I'm setting this issue as "Support request" because I'm not sure if it's a bug.
When I register or log in an user the first time, it works and I get it logged on my website. However, if I log out of the website, go back to login page and click on Twitter icon (which is a link to /user/login/twitter), I see again Twitter page to authorize app, and as soon as I click to authorize, I have the following error message:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Abraham\TwitterOAuth\TwitterOAuthException</em>: Reverse auth credentials are invalid in <em class="placeholder">Abraham\TwitterOAuth\TwitterOAuth->oauth()</em> (line <em class="placeholder">138</em> of <em class="placeholder">/my-project-folder/vendor/abraham/twitteroauth/src/TwitterOAuth.php</em>). <pre class="backtrace">Drupal\social_auth_twitter\Controller\TwitterAuthController->callback()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 184)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 121)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 75)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 84)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
</pre>
If I flush cache and try it again, it works and I'm able to log in on my website.
Have you seen this before? Any ideas what could this be?
Thank you.
Mauricio M. Silveira
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3007413-5.patch | 1.03 KB | gvso |
Comments
Comment #2
gvsoI haven't seen it before. Does it always happen or did it only happen once? Are you writing a custom module that takes advantage of the Social Auth events?
Comment #3
maursilveira commentedHello,
It happened always I tried to log in again on my website through a Twitter account after having log out. Also, I'm calling directly the Social Auth Twitter URL to login, through the Social Icons block created by those modules.
I noticed that disabling completely the page cache with something like
\Drupal::service('page_cache_kill_switch')->trigger();solved the problem, and the issue stopped happening, so I'm using this work around for now. Maybe this information could help you to figure out what's the issue here.Thank you.
Mauricio M. Silveira
Comment #4
manu manuI'm affected by this issue too.
When digging into
TwitterAuthController::callback(), it appears that sometimes the token got from$this->twitterManager->getOauthToken()is empty.I suspect that the
TwitterAuthManagerservice is injected with another Request that the Request loaded later in the controller.Will update this issue if I can find more details.
Comment #5
gvsoThis issue seems to be similar to #2981737: Destination parameter forbids user to be redirected for authentication in which the tokens are not being saved in session before the redirection happens.
Comment #6
gvsoComment #7
manu manuThanks, @gvso.
That seems to resolve the issue!
I will test this more on the following days and will make an update here.
Comment #8
gvsoAny updates on this?
Comment #10
gvsoA new Social Auth release has been added, so we need to create a compatible Social Auth Twitter release. That's why I decided to include this in the new release. If this change was not correct or causes issues, I am happy to revert it.