Пытаюсь настроить общую аутентификацию для backend и frontend, но пока безуспешно.
В common/config/params-local.php
Код: Выделить всё
<?php
return [
'cookieValidationKey' => 'x91OTpoSJBwpCRaoBaGNUttAeo6WRpd-',
'cookieDomain' => '.shop',
];
Код: Выделить всё
'request' => [
'csrfParam' => '_csrf-backend',
'cookieValidationKey' => $params['cookieValidationKey'],
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_identity',
'httpOnly' => true,
'domain' => $params['cookieDomain'],
],
],
'session' => [
// this is the name of the session cookie used for login on the backend
'name' => '_session',
'cookieParams' => [
'httpOnly' => true,
'domain' => $params['cookieDomain'],
],
],
Код: Выделить всё
'request' => [
'csrfParam' => '_csrf-frontend',
'cookieValidationKey' => $params['cookieValidationKey'],
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => '_identity',
'httpOnly' => true,
'domain' => $params['cookieDomain'],
],
],
'session' => [
// this is the name of the session cookie used for login on the backend
'name' => '_session',
'cookieParams' => [
'httpOnly' => true,
'domain' => $params['cookieDomain'],
],
],
Код: Выделить всё
$config = [];
Если в session убираю параметр domain и во frontend и в backend, то аутентифицируется по отдельности в каждом приложении.
Тоже самое происходит если в сессии этот параметр оставляю, но убираю его из identityCookie у backend и frontend.
А общей аутентификации никак не получается.