Symfony 2.1 REST API for login everywhere

I am working on a REST API using Symfony 2.1.

My code works fine, but there is a problem that I can log in to /api/ , but this login can only work under /api/* . But I need to have access to the whole page.

 api: pattern: ^/api #anonymous: ~ form_login: false provider: fos_userbundle http_basic: realm: "REST Service" main: pattern: .* provider: fos_userbundle form_login: check_path: fos_user_security_check login_path: fos_user_security_login default_target_path: wi_homepage logout: path: fos_user_security_logout target: wi_homepage anonymous: true switch_user: true remember_me: key: "%secret%" name: RememberMe lifetime: 2592000 remember_me_parameter: _remember_me 

So, is there a way to do http-entry in the /api/ directory and have access anywhere?

+6
source share
1 answer

the solution is really simple, the context should be the same for both firewalls

 context: some_random_context_name_you_can_choose_freely 

http://forum.symfony-project.org/viewtopic.php?f=23&t=60654&p=164063#p164063

+2
source

All Articles