I'm trying to manually sign in a user.
Previously this was done calling $this->Auth->login()
I can't find how to do it using the Authentication plugin.
I'm trying to manually sign in a user.
Previously this was done calling $this->Auth->login()
I can't find how to do it using the Authentication plugin.
You can manually login users by doing the following Create an Entity of User by getting the user data you want to login. By using setUser, we can finally set the user and finally redirect him to the home page.
public function manualLogin()
{
$user = $this->Users->newEntity($this->request->getData());
$this->Auth->setUser($user->toArray());
return $this->redirect(['controller' => 'Home','action' => 'index' ]);
}