Session expiring in Yii2 despite user activity

I started using Yii2 and should keep more user information in the id. I already know that in Yii2 this should be done using sessions like

Yii::$app->session->set('user.company_id', '121');

This works fine, as I can get these values ​​later in the project using:

Yii::$app->session->get('user.company_id');

. However, these session values ​​are erased despite user activity on the same pages. Thus, after 5-10 minutes, the same user sees some fields based on the session value, however after 1 minute, if I update the session values, they will disappear, which should happen when the session is closed or the user quits.

Any suggestions what am I doing wrong?

+4
source share
1 answer

First check app\config\main.phpor main-local.phpif it contains:

'user' => [
    ...
    'enableAutoLogin' => true,
    ...
],

The second check, if you have the correct assignment for the value assigned to the variable:

$authTimeout;
$absoluteAuthTimeout;

See here for more details .

+2
source

All Articles