Cross-domain login issues


 'user' => [

            //'class' => 'yii\web\User',

            'identityClass' => 'common\models\User',

            'enableAutoLogin' => true,

            'loginUrl' => ['/admin/login'],

            'identityCookie' => [

                'name' => '_identity',

                'httpOnly' => true,

                'path'     => '/',

                'domain' => ".".DOMAIN

            ],

            //'idParam' => '__User',

            //'stateKeyPrefix'=>'vivilawyers',//你的前缀,必须指定为一样

        ], 

       'request' => [

           'cookieValidationKey' => 'vivilawyers'

       ],

         'session' => [

            //'name'=>'asfdafasfafafaf',

            'cookieParams' => [

                'name' => '_identity',

                'domain' => ".".DOMAIN,

                'lifetime' => 0,

                'httpOnly' => true,

                'path'     => '/',

               // 'secure' => false,

            ],

           // 'timeout' => 360000,

        ],

this is my configuration,


if ($model->load(Yii::$app->request->post()) && $model->login()) {

           

           

           print_r(Yii::$app->user);

           return $this->redirect(Url::toRoute('admin/index'));

          

        } else {

            return $this->render('login', [

                'model' => $model,

            ]);

  }

If you add the login code "[color="#FF0000"] print_r(Yii::$app->user);" [/color], Cross-domain login is successful,

If you remove this code, cross-domain logon failure.

If i configure remove


'domain' => ".".DOMAIN,




'session' => [

            //'name'=>'asfdafasfafafaf',

            'cookieParams' => [

                'name' => '_identity',

                //'domain' => ".".DOMAIN,

                'lifetime' => 0,

                'httpOnly' => true,

                'path'     => '/',

               // 'secure' => false,

            ],

           // 'timeout' => 360000,

        ]

Login is successful, cross-domain failure.

This cross-domain login issues someone can solve it?

at common/config/main.php




'user' => [

            'identityClass' => 'common\models\User',

            'enableAutoLogin' => true,

            'loginUrl' => ['/admin/login'],

            'identityCookie' => [

                'name' => '_identity',

                'httpOnly' => true,

                'path'     => '/',

                'domain' => ".".DOMAIN

            ],

           

        ], 

       'request' => [

           'cookieValidationKey' => 'vivilawyers'

       ],

         'session' => [

            'cookieParams' => [

                'name' => '_identity',

                'domain' => ".".DOMAIN,

                'lifetime' => 0,

                'httpOnly' => true,

                'path'     => '/',

            ],

        ],



Using such a configuration, can not log

remove session item ‘domain’ => “.”.DOMAIN,

You can log in, this is where a configuration error that?