Laravel Session Timeout on Login

43 views Asked by At

I have an SPA app that uses Laravel Passport. For the web, I am using sessions. If I set my session.lifetime to 5 minutes, sit on the login page for 5 minutes, and then login, I receive a 419 (session timeout) from the server. What is the proper way to handle this. A non-authenticated sessions starts when the user loads the page. When the user logs in, they are still using that same session. I can detect a 419 on login and try again, but it doesn't seem optimal. I imagine other people have run into this. I think Sanctum makes a xsrf token request before login so that the landing page doesn't need a session. Should I make a fetch before logging to create a new session and refresh XSRF? Any help is greatly appreciated.

0

There are 0 answers