It's pretty easy to do. If session is set to 15 minutes, send an ajax request (on a timer) every 7 or so minutes. It doesn't have to do anything except hit a laravel route. Each hit to the server renews the session. Although for such a simple thing (really a few lines of js code) you don't really need a package, one does exist: https://github.com/GeneaLabs/laravel-caffeine
How to renew the Session automatically from time to time
Hi guys, so we have a request to renew the session every 14 minutes, without having to reload the page.
At the moment we have a lifetime set to 15 minutes, if the user leaves idle for 16 minutes the session will be expired and it redirect to the login page.
But we have case where he is working for more than 15 min in page without doing server request, when they try to save the session is timeout and we have this issue, the idea here is to find a solution to renew the sesssion automatically every 14 min. We thought doing a call to the api to a something like renew_session route, but no sure the best approach here.
Do you guys have come up with this scenario or have any tips or suggestions how is a good way to auto renew the session?
Please or to participate in this conversation.