Symfony 5 Security: Authenticators
When Authentication Fails
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

Check out this code in our authenticator:

public function authenticate(Request $request): Passport
{
    $email = $request->request->get('email');
    $password = $request->request->get('password');

    if ($email === 'ryan@symfonycasts.com') {
        throw new UserNotFoundException('Get outta here Ryan!');
    }

    return new Passport(new UserBadge($email), new PasswordCredentials($password));
}

public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
{
    dd($exception);
}

If I try to login as ryan@symfonycasts.com, what type of object will be dumped inside onAuthenticationFailure()? And if we redirected to /login and rendered that error, what text would be displayed?

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.