I'm using Laravel Jetstream (which uses Laravel Fortify for authentication). The default behaviour seems to be that if a user is inactive for a period of time longer than the SESSION_LIFETIME
in the .ENV
file, the session expires.
I'm trying to modify how this session expiration is dealt with. Currently when a user comes back to their computer to an expired session, if they click to navigate pages (e.g. any GET request) they'll be pushed back to the login page and are able to re-authenticate, which is great.
However the issue is that if they were in the middle of creating something like a blog post, which hasn't been saved yet, they become inactive for a longer period of time than SESSION_LIFETIME
and their session expires, then they return to their computer, and continue adding to their blog post, when they try to save (a non-GET request) a 405 response (method not supported) is returned, and the user won't be able to save their post and will likely lose their work.
I essentially have two options here (1) set the SESSION_LIFETIME
something like 2 weeks out so that this is unlikely to happen, or (2) create something like a modal that opens and allows the user to re-authenticate from their current page, thereby maintaining potentially unsaved data. Does anyone have experience with this? Most of the functionality seems to be from within /vendor/laravel
folders so I'm not sure if it will be easy/worth it to change the functionality.
Thanks