Hello,
I’m working on a project using Laravel 11 and encountering issues with the “Remember Me” functionality. Even though the “Remember Me” checkbox is selected and the information is stored in the database, users are forced to log in again after closing and reopening the browser.
Here are my relevant configurations:
In config/session.php
:
'lifetime' => env('SESSION_LIFETIME', 60),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), // I tried both true and false
In .env
:
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
I tried changing SESSION_LIFETIME
from 120 to 60, but it didn’t make a difference. Whether expire_on_close
is set to true
or false
, the user is logged out after closing the browser. However, the “Remember Me” information is being stored correctly in the database.
How can I fix this issue so that users remain logged in even after closing and reopening the browser when the “Remember Me” option is checked?
Thanks!