I am working on a REST API using Symfony 2.1.
My code works now perfectly, but there is problem that I can login in /api/
but this login can work only under /api/*
. But I need to have access to 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 any way to make http login under /api/
directory and have access to anywhere?
solution is really simple, there needs to be same context 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With