From f422a70fc3b40549a583ea9bef709ea5489637dc Mon Sep 17 00:00:00 2001 From: andrey Date: Mon, 2 Aug 2021 18:37:12 +0300 Subject: [PATCH] user login cors --- .../modules/api/controllers/UserController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/modules/api/controllers/UserController.php b/frontend/modules/api/controllers/UserController.php index 7a6c2a4..07bf9eb 100644 --- a/frontend/modules/api/controllers/UserController.php +++ b/frontend/modules/api/controllers/UserController.php @@ -3,6 +3,8 @@ namespace frontend\modules\api\controllers; +use common\behaviors\GsCors; +use common\classes\Debug; use common\models\User; use frontend\modules\api\models\LoginForm; use Yii; @@ -29,6 +31,19 @@ class UserController extends ActiveController 'authenticatior' => [ 'class' => QueryParamAuth::class, //implement access token authentication 'except' => ['login'], // no need to verify the access token method, pay attention to distinguish between $noAclLogin + ], + 'corsFilter' => [ + 'class' => GsCors::class, + 'cors' => [ + 'Origin' => ['*'], + //'Access-Control-Allow-Credentials' => true, + 'Access-Control-Allow-Headers' => [ + 'Content-Type', + 'Access-Control-Allow-Headers', + 'Authorization', + 'X-Requested-With' + ], + ] ] ]); }