[ 'class' => HttpBearerAuth::className(), 'except' => ['token'], ] ]); } public function actions() { $action = parent::actions(); unset($action['delete']); unset($action['create']); unset($action['update']); unset($action['index']); $action['options'] = [ 'class' => 'yii\rest\OptionsAction', 'collectionOptions' => ['PUT', 'GET', 'OPTIONS'] ]; return $action; } public function actionIndex() { return Yii::$app->user->identity; } /** * @return string * @throws \yii\base\Exception * @throws \yii\web\NotFoundHttpException * @throws \yii\web\ServerErrorHttpException */ public function actionToken() { return Login::wxLogin(); } }