@tebowner You may use a middleware to check session. If Session empty then redirect to your destination.
CSRF token mismatch error on session timeout / form
A session timeout causes a Token error on a post. This is not a malicious attempt... I am looking for a way to redirect the user back to my login page anytime a session timeout occurs and they try and "do something".
Right now i get the error page in Production but no real error occurred. On a Session timeout - would be nice if the timeout could redirect to my login page and display message
Hi @tebowner, I have addressed this problem (in a way I am comfortable with) here: https://github.com/GeneaLabs/laravel-caffeine
The way it solves the problem is by keeping the session alive on pages that have a token. Other pages will simply expire as usual. I would be interested to hear if there are any use-cases where this method is not appropriate (so that I can address that in the package as well)? The main reason I did not use redirect to the login page was to accommodate AJAX submitted requests. Perhaps there is a way to elegantly handle that, though, without loosing the form data.
Let me know how this works for you.
Please or to participate in this conversation.