In this line 'lifetime' => env('SESSION_LIFETIME', 120), the session is configured for 2 hours.
Oct 29, 2023
2
Level 1
Authorization disappears
I'm using standard authorization from Laravel and Redis to store sessions.
This is how I authorize users:
Auth::loginUsingId($userID, true);
After some time (it could be a day or an hour) does authorization disappear? Why? I set the flag to remember the session. And it apparently works, because authorization can last a day. Also, authorization disappears if you log in from 3 devices. When authorizing from 4 devices, it will disappear from the first one. Why? After all, there is no limit on authorized devices.
This is my session.php config:
<?php
use Illuminate\Support\Str;
return [
'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => env('SESSION_CONNECTION'),
'table' => 'sessions',
'store' => env('SESSION_STORE'),
'lottery' => [2, 100],
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('REDIS_PREFIX_SLUG', 'laravel'), '_').'_session'
),
'path' => '/',
'domain' => env('SESSION_DOMAIN'), //I'm using .site.com so that the cookies are available on the subdomain
'secure' => env('SESSION_SECURE_COOKIE'),
'http_only' => true,
'same_site' => 'lax',
];
Please or to participate in this conversation.