I have error in the answer Postman with authentication token using YII2?

Good day! Given API in YII2 will need to implement the frontend, but when trying to get answers to Posman an error is displayed. For example, during authorization. Set {'login':'user15335551863','password':'pass'} and the corresponding url. You get the error:
5cf269f65a2d6028715333.png
In User model:
public function login()
{
 if($this->validate()) {

 $user = self::findOne(['login' => $this->login]);

 $user->token = Yii::$app->security->generateRandomString();
$user->save();

 return [
 'token' => $user->token
];
 } else {
 return [
 'errors' => $this->errors
];
 }

In the controller:
public function actionLogin()
{
 $user = new User();
$user->load(Yii::$app->request->post ()");
 $user->scenario = 'login';
 return $user->login();
 }

In web.php:
'urlManager' => [
 'enablePrettyUrl' => true,
 'showScriptName' => false,
 'rules' => [
 'POST /api/login' => 'user/login',
[
 'class' => 'yii\rest\UrlRule',
 'controller' => ['user'],
 ],


API deployed on OpenServer. Performed a composer update. Created database and prescribed in db.php. Then began to test it in Postman error.
Tell me what may be causing this error?
March 23rd 20 at 18:39
0 answer

Find more questions by tags API