Answer the question
In order to leave comments, you need to log in
How to use single sessions on different domains and sites?
Hello.
The situation is this: there are two physical servers. The first is site.com (Yii2 advanced) and the second is abc.site.com (Yii2 basic). It is necessary to organize joint sessions based on Yii2, so that when a user logs in to site.com and goes to abc.site.com, this user's authorization session is saved. Is this even possible? If so, please provide links with examples. Thank you.
Answer the question
In order to leave comments, you need to log in
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => '@frontend/runtime/cache' //делаем общий кеш
],
'request' => [
'csrfParam' => '_csrf-myap', //тоже делаем такое же как и на frontend
'cookieValidationKey' => 'nk34HGdd8w6rf', //тоже делаем такое же как и на frontend
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_identity',
'httpOnly' => true,
'domain' => '.' . DOMAIN,
],
],
'session' => [
'cookieParams' => [
'domain' => '.' . DOMAIN,
'httpOnly' => true,
],
],
defined('DOMAIN') or define('DOMAIN', 'mysite.com');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question