Unrecognized options "csrf_provider" under "security.firewalls.form_login"

csrf, fosuserbundle, symfony

Solution

You need to enable csrf protection. You can do that by adding a key to the config.yml

framework:
    csrf_protection:
        enabled: true

Problem

I'm trying to install the FOSUserBundle following the tutorial here When I'm at the 7th step I try to update the database schema for ORM running php app/console doctrine:schema:update --force but appears the error ``` InvalidConfigurationException: Unrecognized options "csrf_provider" under "security.firewalls.form_login" ``` Here's my firewall: ``` firewalls: main: pattern: form_login: provider: fos_userbundle csrf_provider: form.csrf_provider logout: true anonymous: true ``` What can I do? I don't set a pattern because, if I set something like ``` pattern: ^/ ``` the following error appears: InvalidTypeException: Invalid type for path "security.firewalls.pattern". Expected array, but got string UPDATE: The csrf_protection was enable but, for some reason that I don't understand, didn't work. I tried to "reset" it, disabling and enabling, and now it works. In my project I enable it with ``` csrf_protection: ~ ```

Original source

Related problems