your ajax calls need to handle errors and check if the error is the fact that you are (now) unauthorized
The framework cannot really handle it any other way. A request that requires json is not going to be able to trigger a server specified redirect
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm not sure but I'm really surprised I haven't seen this talked about and any solutions for it. But when a user is logged in and walks away until the session is expired - when they come back what is the process of automatically either re-logging them in or showing the login page?
Maybe I've just missed it in my travels around laravel, but everytime it happens with my app, when I come back and click something, it just fails and unless I open the console and see errors, I wouldnt know that I need to refresh the page - not a great UX.
So doesn't Laravel handle this?
Please or to participate in this conversation.