Symfony2.4 SonataAdminBundle Logout error: You must activate the logout in your security firewall configuration

Jalmarez picture Jalmarez · Feb 22, 2014 · Viewed 8k times · Source

Login works fine. Getting error at /admin/logout

You must activate the logout in your security firewall configuration.

at

in *\vendor\sonata-project\user-bundle\Controller\AdminSecurityController.php at line 98

I'm setting logout to true as documented:

security.yml:

firewalls:
        main:
            pattern:      .*
            #pattern: ^/
            form-login:
                provider:       fos_userbundle
                csrf_provider:  form.csrf_provider
                login_path:     /login
                use_forward:    false
                check_path:     /login_check
                failure_path:   null
            logout:       true
            anonymous:    true

How do you avoid this error using symfony2.4, fosuserbundle1.3 and sonata-admin dev-master ?

Answer

Pierre picture Pierre · Feb 22, 2014

The logout node in your security.yml should contain two subnodes defining the logout path and the target where a user gets redirected after a logout:

logout:
    path:   /admin/logout
    target: /

Not sure if this also works in sonata context, but it should work under normal conditions.