theorist
(Oleg Wrs)
1
Hello.
I’m using nodge Eauth with facebook oauth authorization on my site.
Always when I close and reopen my browser - I should re-login, but my session lifetime is 1 year.
Here is a code where I try to set up my sessions:
// components config
'session'=>[
'class' => 'yii\web\Session',
'timeout' => 31556926,
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'authTimeout' => 31556926,
],
// actionLogin code
if(!empty($identity)) {
Yii::$app->getUser()->login($identity, 31556926);
$eauth->redirect(Url::to(Yii::$app->request->referrer));
}
Can anyone help me?
Set this:
'enableAutoLogin' => false,
theorist
(Oleg Wrs)
3
Thank you very much, it was helpful.
But I don’t understand, why should I set that parameter to false?
Hi!
I’m not sure with my answer because I never used extensions for “external logins” in my applications so far.
but after reading:
http://www.yiiframework.com/doc-2.0/yii-web-user.html#$enableAutoLogin-detail
enableAutoLogin = true
"Whether to enable cookie-based login."
I would understand it like:
Cookie-based login from the cookie set by Yii / your app.
But when you use an "external" login its actually not YOUR yii-application which sets the cookie.
So when you return to your app it is looking for a "yii own" cookie and fails…
The result is: you are not logged in.
…
like I said - I’m not sure with this and can be totally wrong.
But it would make sense to me.
@Anyone - please correct me if I’m wrong.
(because I would like to know the reason also)
Best Regards
theorist
(Oleg Wrs)
5
MetaCrawler, I sure you are right!
Thanks to all for your help.