I am using FOSUserBundle and FOSUserFacebookBundle to authenticate my users. The issue is that when I visit my /login page. I have two text field with a username and password. When I input my username and password, I am getting the following error:
The Facebook user could not be retrieved from the session.
This is such a weird error because I am logging in the user via a form and not via facebook, but it’s as if I am logging in the user via facebook. So I played around with my source code and here’s my security.yml/firewall settings:
firewalls:
main:
pattern: ^/.*
form_login:
login_path: /login
check_path: /login_check
provider: fos_userbundle
fos_facebook:
app_url: "http://apps.facebook.com/myapp/"
server_url: "http://localhost/Symfony/web/app_dev.php"
login_path: /login
check_path: /login_check
default_target_path: /
provider: my_fos_facebook_provider
anonymous: true
logout:
path: /logout
target: /
handlers: ["fos_facebook.logout_handler"]
#http_basic:
# realm: "Secured Demo Area"
login:
pattern: ^/login$
security: false
What I am worried about is that the /login_check, will check for facebook session to exists all the time, which I don’t really want. When I change the login_path and check_path for the fos_facebook, everything works just fine. Any idea what might cause this and how to solve this issue?
Your check_path should be different for form_login and fos_facebook. For example: