B. Klaus
B. Klaus

Reputation: 11

Session expiring for some minutes automatically in yii2

I want following features on Yii2 website:

1) I want to make the users visiting the website without signing in again, once he logged in and he didn't log out yet. To do this, I made a configuration as follows:

'user' => [
  'identityClass'   => 'common\models\User',
  'enableAutoLogin' => true,
],

2) But in this case, session is expired after a while if a user is idle for some minutes. On our website, the user should upload a video, but video uploading takes a long time, even one hour. So there can be no activity for one hour, but after uploading a video is done, Yii::$app->user->isGuest returns false. So the next process is not going on.

I want to resolve this problem, and I want to increase session expiration time to more than 5 hrs.

Please help me. I am now using Yii2.

Upvotes: 1

Views: 307

Answers (1)

ScaisEdge
ScaisEdge

Reputation: 133360

Assign proper value to authTimeout in your config

'user' => [
        'identityClass' => 'app\models\User',
        'enableAutoLogin' => true,
        'enableSession' => true,
        'authTimeout' => 60,
    ],

see this ref for more

and eval also absoluteAuthTimout

http://www.yiiframework.com/doc-2.0/yii-web-user.html

Upvotes: 0

Related Questions