Hi,
i create Yii2 app, with user module,
the user class implement identity but it dont extends ActiveRecord because i dont have a DB, i authenticate user from some kind of external API
i create my own user model, and in loginForm.php i do this
and login() in function
the probem is on (Yii::$app->user->login($user,3600 * 24 * 30)
it create a user identity but when i redirect the page , i lose it,
on main.php config file i added the follwing:
but still dont have user identity after redirect
P.S when i print user identity before redirect , i can see it created for log in user and everything fine , it happen after first redirect.
what i miss to keep user log in ?
Not sure if it helps but take a look here:
http://www.yiiframework.com/forum/index.php/topic/61364-losing-user-identity-upon-redirect-after-successful-login/
Quote from Lukos:
Hope this helps
Best regards
If You are using database:
class User extends \yii\db\ActiveRecord implements \yii\web\IdentityInterface
{
}
If You are not using database:
class User extends \yii\base\Model implements \yii\web\IdentityInterface
{
}