add api authentication

This commit is contained in:
kirill
2021-07-28 18:15:38 +03:00
parent 1a2347ef99
commit 3f97cb7c04
5 changed files with 189 additions and 6 deletions

View File

@ -15,6 +15,15 @@ return [
'modules' => [
'api' => [
'components' => [
'user' => [
'identityClass' => 'frontend\modules\api\models\User',
'enableAutoLogin' => true,
'enableSession' => false,
'class' => 'frontend\modules\api\models\User',
//'identityCookie' => ['name' => '_identity-api', 'httpOnly' => true],
],
],
'class' => 'frontend\modules\api\Api',
],
'access' => [
@ -32,6 +41,9 @@ return [
'request' => [
'csrfParam' => '_csrf-frontend',
'baseUrl' => '',
'parsers' => [
'application/json' => 'yii\web\JsonParser',
],
],
'user' => [
'identityClass' => 'common\models\User',