I am trying to create a login api and went to the link https://github.com/yiisoft/yii2/blob/master/docs/guide/security-authentication.md
the above url says:
To log in, you can use the following code:
// find a user identity with the specified username. // note that you may want to check the password if needed $identity = User::findOne(['username' => $username]); // logs in the user Yii::$app->user->login($identity);
where this line should be added to the controller action or class that implements IdentityInterface.
When adding the specified line to the controller action, but I get the error message Argument 1 passed to yii\web\User::login() must implement interface yii\web\IdentityInterface, null given, called in C:\wamp\www\basic\controllers\MyController.php on line 202 and it is determined where the class that implements the Identity interface is the actual model called Myuser (app \ models \ myuser).
Why does he say that yii\web\User::login() should implement an authentication interface?
And if a way to send published parameters to the login function is added to the Myuser class?
Can someone help me with this?
source share