我有一个带有 OAuth 身份验证的登录页面(FOSUserBundle + HWIOAuthBundle)。它正在与谷歌和 Facebook 合作。
当我尝试使用我的雅虎帐户登录时,我只是被重定向到我的登录页面而没有错误。如果我点击 Google 或 Facebook 按钮,我会被正常重定向到权限页面。
我看不出问题的原因,也不明白为什么没有例外。
在 config.yml:
hwi_oauth:
firewall_name: main
fosub:
username_iterations: 30
properties:
facebook: facebook
google: google
yahoo: yahoo
resource_owners:
facebook:
type: facebook
client_id: my_f_cid
client_secret: my_f_sk
scope: "email"
yahoo:
type: yahoo
client_id: my_y_cid
client_secret: my_y_sk
scope: "email"
google:
type: google
client_id: my_g_sid
client_secret: my_g_sk
scope: "email"
在 security.yml:
security:
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
login_path: /login
check_path: /login_check
oauth:
failure_path: /login
login_path: /login
resource_owners:
facebook: "/login/check-facebook"
google: "/login/check-google"
yahoo: "/login/check-yahoo"
在 routing.yml:
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /login
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /login
hwi_facebook_login:
pattern: /login/check-facebook
hwi_google_login:
pattern: /login/check-google
hwi_yahoo_login:
pattern: /login/check-yahoo
登录按钮:
<a id="btn-facebook" href="http://localhost:8000/app_dev.php/login/facebook">
<img src="/bundles/auth/images/social_login_facebook.png">
</a>
<a id="btn-google" href="http://localhost:8000/app_dev.php/login/google">
<img src="/bundles/auth/images/social_login_google.png">
</a>
<a id="btn-yahoo" href="http://localhost:8000/app_dev.php/login/yahoo">
<img src="/bundles/auth/images/social_login_yahoo.png">
</a>