Providers: Twitter Stateless Session store not set on request.
I’m trying to implement stateless redirecting to twitter from my Lumen app, but every time it gives an error saying: Session store not set on request.
I followed all the installation instructions of the Twitter provider correctly.
Although the provider should automatically detect I want stateless, I extra noted it in the call:
return Socialite::driver('twitter')->stateless()->redirect();
Do you guys have an idea what might be wrong?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 29 (4 by maintainers)
No one send a PR in months so the people that encounter this issue don’t seem to have that big of an issue with it. Feel free to send a PR unless it is to hacky as Twitter doesn’t support it by default.
Sent from TypeApp
On 15 Jul 2017, 23:31, at 23:31, Bart Nagel notifications@github.com wrote:
Hey, @tremby great idea. I didn’t want to modify directly the lib so I tried to modify my Controller, with success !
Here’s a simplified sample :
BEFORE instanciate the Socialite Driver, add a cache key to the callback uri
( in my code the cache key is set into a class property to use it after, but here I simplified a lot)
Then when redirecting, before that, take the session value and push it into the cache :
Finally, in the callback function, before obtaining the user, take the “key” in the request, pull the cache and store it in session :
One potential solution which would involve cache but not session:
oauth_callbackparameter to the/oauth/request_tokencall to Twitter, such as by adding?user=$tempIdto the configured callback URL.oauth_tokenandoauth_token_secret, and cache these, keyed by the identifier, for some short amount of time (perhaps one minute).This isn’t technically stateless of course, but it avoids use of sessions and therefore cookies.
I have some proof of concept code working which I hacked into Laravel Socialite. In
vendor/laravel/socialite/src/One/TwitterProvider.phpI have added:Another way to do this which would shift the temporary sliver of state to the client side might be to use a short-lived encrypted cookie.
Any thoughts?
+1 Running into the same issue
From the link you gave:
I could be mistaken, but I believe that is not useful for Socialite.
Well I was waiting for feedback on what I posted above.