I have a problem, that when I switch the language on my site, and I do a Facebook Login using HWIOAuthBundle
, I always get redirect to the default locale, what I set in the config.yml
. (in my case: "en")
routing.yml
# Facebook Connect
hwi_oauth_security:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /{_locale}/login
defaults: { _locale: en }
requirements:
_locale: en|de
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /{_locale}/login
defaults: { _locale: en }
requirements:
_locale: en|de
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /{_locale}/login
defaults: { _locale: en }
requirements:
_locale: en|de
facebook_login:
path: /{_locale}/login/check-facebook
defaults: { _locale: en }
requirements:
_locale: en|de
# Site Routing #
homepage:
path: /{_locale}
defaults: { _controller: MyPageBundle:Homepage:index, _locale: en }
requirements:
_locale: en|de
oauth firewall settings in security.xml
firewalls:
main:
oauth:
resource_owners:
facebook: "/%locale%/login/check-facebook"
login_path: fos_user_security_login
failure_path: fos_user_security_login
oauth_user_provider:
service: hwi_oauth_user_provider
always_use_default_target_path: true
default_target_path: "/%locale%"
After that when I open the mysite.com/en/login/facebook
, I get successfully logged in with my facebook account and get redirect to the following link: mysite.com/en#_=_
But when I open mysite.com/de/login/facebook
, I get redirect to the same url like in the previous case. It seems that the locale doesn't get passed after the redirection and fallbacks to the default locale.
In every other case the locale works fine. For example I'm using FOSUserBundle and after login, logout or signup I get redirect with the correct locale every time.
Could someone help me to solve this problem? Thank you in advance!