Symfony 4.2 can’t Logout

Thank you for reading.
i would like implement the logout action on my symfony project.

At the moment, when i make the logout action, i receive the manually throwed exception controller can be blank: it will never be executed!‘.

But from internet and symfony doc, normally this endpoint controller is never reached.

In my context,i can’t logout and i don’t know why this logout function is executed.

this is my configuration
SecurityController.hp

 /**
 * @Route("/logout", name="app_logout", methods={"GET"})
 */
public function logout()
{
    // controller can be blank: it will never be executed!
    throw new Exception('controller can be blank: it will never be executed!');
}

security.yaml

    firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    main:
        anonymous: ~
        pattern:  /login
        provider: app_user_provider
        guard:
            authenticators:
                - AppSecurityLoginFormAuthenticator
        logout:
            path: app_logout
            # where to redirect after logout
            target: app_login

Have a nice day!

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *