You must configure the check path to be handled by the firewall using form_login in your security firewall configuration
I think you need to put form_login
under a firewall ( either main
or add another one )
form_login under main firewall :
firewalls: main: pattern: ^/admin form_login: provider: fos_userbundle login_path: fos_user_security_login check_path: fos_user_security_check csrf_provider: form.csrf_provider logout: true anonymous: true ....
form_login under another firewall
firewalls: main: pattern: ^/admin second_firewall: pattern: ^/ form_login: provider: fos_userbundle login_path: fos_user_security_login check_path: fos_user_security_check csrf_provider: form.csrf_provider logout: true anonymous: true .....
Your code is wrong only in the part of check_path value.
This is your original code:
firewalls: main: pattern: ^/admin form_login: provider: fos_userbundle login_path: fos_user_security_login check_path: fos_user_security_check csrf_provider: form.csrf_provider logout: true anonymous: true
And you should use something like:
firewalls: main: pattern: ^/admin form_login: provider: fos_userbundle login_path: fos_user_security_login check_path: /login_check csrf_provider: form.csrf_provider logout: true anonymous: true
Note that check_path has as value only a string. If you use the value fos_user_security_check you are calling to SecurityController.php class and invoking the checkAction() method which exactly only throws an RuntimeError Exception with the error displayed "You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.". So the fix is so simple that not use the value fos_user_security_check
pattern: ^/admin
This is possibly where your problems start.
Try changing this back to ^/
Then change your routes for FosUserBundle
# app/config/routing.ymlfos_user_security: resource: "@FOSUserBundle/Resources/config/routing/security.xml" prefix: /adminfos_user_profile: resource: "@FOSUserBundle/Resources/config/routing/profile.xml" prefix: /admin/profilefos_user_register: resource: "@FOSUserBundle/Resources/config/routing/registration.xml" prefix: /admin/registerfos_user_resetting: resource: "@FOSUserBundle/Resources/config/routing/resetting.xml" prefix: /admin/resettingfos_user_change_password: resource: "@FOSUserBundle/Resources/config/routing/change_password.xml" prefix: /admin/profile