admin管理员组文章数量:1122832
Yii2
When i put var_dump in findIdentityByAccessToken method is not called
Why is findIdentityByAccessToken method not called? Why is there no user verification?
curl -H "Authorization: Bearer tok" -H "Accept: application/json" https://....plcapp/cooper/listcontr
I get error 403.
<?php
namespace common\modules\plcapp\controllers;
use Yii;
use yii\helpers\ArrayHelper;
use yii\filters\auth\HttpBearerAuth;
use yii\web\Response;
use yii\filters\AccessControl;
//use yii\rest\ActiveController;
use yii\web\Controller;
//use yii\filters\VerbFilter;
//use yii\web\NotFoundHttpException;
use common\models\Access;
use common\models\DevContr;
use common\models\User;
use yii\web\IdentityInterface;
class CooperController extends Controller
{
//public $modelClass = 'common\models\User';
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = [
'class' => HttpBearerAuth::class,
];
return $behaviors;
}
public function actionConect()
{
return $this->render('index');
}
public function actionListcontr()
{
Yii::$app->response->format = Response::FORMAT_JSON;
return [
'success' => true,
];
}
}
LGpt4 chat can't say anything useful
本文标签: yii2When using HttpHeaderAuththe findIdentityByAccessToken method is not calledStack Overflow
版权声明:本文标题:yii2 - When using HttpHeaderAuth, the findIdentityByAccessToken method is not called - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299728a1930561.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论