Problem:
We have been using the FOSUserBundle for Symfony2, and all works fine, including the "remember me".
We recently introduced FOSFacebookBundle. Since then the "remember me" for "normal" login is broken.
For example:
When we use ONLY FosUSer if a user logs in via the login-form, and stays, for exemple 5 hours without activity, after clicking any link all continues to work, with the user logined and identified.
When we activate the FosFacebook, the same user also logs in via the login-form (not from facebook) and stays a time without activity. After clicking any link, he is redirected to the login form and after having entered its password again, the is redirected again to the target URL.
If we deactivate the FosFacebook from the config, the "remember me" for the FosUser works again correctly.
Question:
Is it normal that FosFacebook breaks the FosUser "natural" remember me for users not using FB?
If should work properly... can anyone see if we've done mistakes in our config files?
Config Files:
config.yml
# FOS User
fos_user:
db_driver: %database_method% # other valid values are 'mongodb', 'couchdb'
firewall_name: main
user_class: Common\ODMBundle\Document\User
from_email:
address: %fos_email_address%
sender_name: %fos_sender_name%
profile:
form:
type: fos_user_profile
handler: fos_user.profile.form.handler.default
name: fos_user_profile_form
validation_groups: [Profile]
change_password:
form:
type: fos_user_change_password
handler: fos_user.change_password.form.handler.default
name: fos_user_change_password_form
validation_groups: [ChangePassword]
registration:
confirmation:
enabled: true
template: FOSUserBundle:Registration:email.txt.twig
form:
type: fos_user_registration
handler: fos_user.registration.form.handler.default
name: fos_user_registration_form
validation_groups: [Registration]
resetting:
token_ttl: 600
email:
template: FOSUserBundle:Resetting:email.txt.twig
form:
type: fos_user_resetting
handler: fos_user.resetting.form.handler.default
name: fos_user_resetting_form
validation_groups: [ResetPassword]
# FOS facebook
fos_facebook:
file: %kernel.root_dir%/../vendor/facebook/src/base_facebook.php
alias: facebook
app_id: xxxxxxxxxxxxxxx
secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cookie: true
permissions: [email, user_birthday]
security.yml
security:
providers:
fos_userbundle:
id: fos_user.user_manager
my_fos_facebook_provider:
id: my.facebook.user
factories:
- "%kernel.root_dir%/../vendor/bundles/FOS/FacebookBundle/Resources/config/security_factories.xml"
firewalls:
main:
pattern: ^/
fos_facebook:
check_path: /login_checkFB
default_target_path: /user/
provider: my_fos_facebook_provider
form_login:
provider: fos_userbundle
default_target_path: /user/
logout: true
anonymous: true
switch_user: true
remember_me:
key: aSecretKey
lifetime: 604800
path: /
domain: ~
access_control:
#- { path: ^/.*$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/private/, role: ROLE_USER }
- { path: ^/user/, role: ROLE_USER }
- { path: ^/admin/, role: ROLE_ADMIN }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]