CompositeAuth::class, 'authMethods' => [ [ 'class' =>HttpBasicAuth::class, 'auth' => function ($username, $password) { $user = User::find()->where(['username' => $username])->one(); if ($user->verifyPassword($password)) { return $user; } return null; }, ], HttpBearerAuth::class, QueryParamAuth::class, ], ];*/ $behaviors['authenticator'] = [ 'class' => HttpBearerAuth::class, ]; return $behaviors; } /** * {@inheritdoc} */ public function init() { parent::init(); \Yii::$app->user->enableSession = false; // custom initialization code goes here } }