-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Still getting TokenMismatchException after Laravel session lifetime #22
Comments
Update: Did some testing... First I was thinking that maybe ajax was caching the request, so I tried to ping your route with jQuery and with cache disabled, but the session still expired. So that's not the issue.
If I ping a normal route (that returns my home view), the form keeps working and the session doesn't expire.
Finally I got it to work by commenting out your package route and creating my own route. If I get rid of the default controller namespace
If I don't bypass the namespace I need to create my own route and controller method:
and
So why your package route is not keeping the session alive is still a mystery to me... |
Update 2: Found the issue! :) In your Haven't found a proper way to check if a route group is set though... |
Thanks for reporting and looking into this. I'm on the road this weekend but will look into it as well if I can. |
@ivanvermeyen thanks again for your research on this. Can you check if release 0.3.4 fixes this? Go ahead an re-open if the issue persists. :) |
Got an error:
This works for me:
Mind the cast to |
Thanks for the follow-up. What version of Laravel do you have installed and what version of PHP are you using? It looks like this is down to versioning differences, as this worked for me. getAction is actually returning arrays for me, so not sure what the difference is. |
I am running the latest Laravel (5.2.20) on a Homestead box with PHP 5.6. |
Just a thought. Perhaps you can do a version check instead?
If using Laravel >= 5.2 and no 'web' group exists, adding the route to that group doesn't seem to throw any errors, so it can't hurt? Or perhaps you can add middleware groups to the config file, in case people rename their groups? Edit: Might be better to use |
Yea, this is getting really tricky. I will cast to array for now. |
Should now be fixed in 0.3.5 |
|
Sorry, working while traveling on the road ... not sure why that is happening for you. Do you only have a single middleware group? I wonder if it returns as string if there's only a single group, and array if multiple. REALLY ANNOYING. Could also be a difference between PHP 5.x and PHP 7. Thanks for your patience on this. |
There are 2 default middleware groups in my I've been searching through the Laravel code and found this reference, but it doesn't really help much. :) It's fun to try and understand the inner workings tho. It just requires a lot of digging :) Thanks for taking the time to look into this so fast and enjoy your weekend! :) 👍 |
Is it working now with the array casting? :) |
It's working now :) https://laravel.com/docs/5.2/middleware#registering-middleware According to the docs you can do:
or:
I was using the first one with 'web'. So it seems whatever you specify there is what is returned from the |
Hi
When I leave a form open for a while, I still get a
TokenMismatchException
.I'm using Laravel 5.2.
For testing I've set the session lifetime in
config/session.php
to 3 minutes and the drip interval to 1 min (60000ms). The drip route is being called every minute as it should (no errors in the Chrome network tab).After the first drip I can still send the form, but after 3 drips or minutes I get the Token exception.
Seems the session isn't actually being refreshed?
The text was updated successfully, but these errors were encountered: