Currently have an issue: Im migrating from authcomponent to the authentication plugin and for some reason, after a successful login, im still getting redirected back to the login page.
$result = $this->Authentication->getResult();
if ($result->isValid()) {
//some logic for updating some database fields (last login etc)
$target = $this->Authentication->getLoginRedirect();
if (!$target) {
$target = ['controller' => 'Accounts', 'action' => 'index'];
}
return $this->redirect($target);
}
//wrong password error logic here
After logging in, it starts a redirect loop between accounts/ and users/login.
If i change the unAuthenticatedRedirect to something random, it still redirect to login, so its seems to be authenticated?
AuthenticationService setup:
$authenticationService = new AuthenticationService([
'unauthenticatedRedirect' => Router::url('/users/login'),
'loginRedirect' => Router::url('/accounts'),
'logoutRedirect' => Router::url('/users/login'),
'queryParam' => 'redirect',
]);
//authenticators and identifiers....
Everything is based off either the CMS tutorial or the migration guide.