[ 'class' => AccessControl::class, 'rules' => [ [ 'class' => ActiveUserRule::class, 'actions' => [ 'credentials', ], ], ], ], ]); } public function actionCredentials() { $account = Yii::$app->user->identity; $model = new TwoFactorAuthForm($account); return $model->getCredentials(); } }