I am trying to create a user login with symfony 4 based on the tutorial from symfony.com.
I used the basic services.yaml file with the code below.
https://symfony.com/doc/current/security/form_login_setup.html
public function loginAction(Request $request, \Twig_Environment $twigRenderer,AuthenticationUtils $authUtils)
{
// get the login error if there is one
$error = $authUtils->getLastAuthenticationError();
// last username entered by the user
$lastUsername = $authUtils->getLastUsername();
return new response($twigRenderer->render('security/login.html.twig', array(
'last_username' => $lastUsername,
'error' => $error,
)
));
}
Errror:
Controller "App\Controller\SecurityController::loginAction()" requires that you provide a value for the "$authUtils" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.
I don`t know how to solve this. Does someone have a suggestion?
I was with the same problem .. Try to run the command:
composer require security
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With