php - I can't save user identity in yii2 -
i created module in yii2 under api/modules/v1 folder, problem when request:
yii::$app->user->login($user, 3600);
the identity got saved temporary until refresh page or request url, when reviewed log file, found : user '1' logged in ::1. session not enabled. tried add :
'enableautologin' => true, 'enablesession' => true,
user component configuration :
'user' => [ 'identityclass' => 'common\models\user', 'enableautologin' => true, 'enablesession' => true, 'identitycookie' => [ 'name' => '_apiuser', // unique backend 'path' => '/api/web/v1' // correct path backend app. ] ], 'session' => [ 'name' => '_apisessionid', // unique frontend 'savepath' => __dir__ . '/../runtime', // temporary folder on frontend ],
but same problem occurred.
have model common\models\user implements "login" method? if so, login code
yii::$app->user->identity->login($user, 3600);
Comments
Post a Comment