I\'am working on a REST API. Therefore I prepared a function which sends the authentication data via curl to the REST Server. I\'ve implemented two authentication options. T
You can use yii2's HttpBasicAuth authenticator behaviour for bearer token auth.
use yii\filters\auth\HttpBasicAuth;
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = [
'class' => HttpBasicAuth::className(),
];
return $behaviors;
}
Authentication
For the solution you were suggesting, you should use json request parser.
'request' => [
'parsers' => [
'application/json' => 'yii\web\JsonParser',
]
]
JsonParser