Yii2 API initialization. Behavior () Doesn't work
I am creating a restful api in yii2. I ran into a problem here. In my userController.php, I created a behavior () for authentication.
use yii\filters\auth\HttpBasicAuth;
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = [
'class' => HttpBasicAuth::className(),
'except' => ['signup']
];
return $behaviors;
}
This is where I went through 'except' => ['signup']
, so authentication shouldn't be applied to the "signup" action.
But it doesn't apply here and asks for authentication for the "signup" action.
So please guide where I went wrong.
+3
source to share