我正在设置 FOSUserBundle 和 HWIOAuthBundle("0.3.*@dev") 以使用 facebook 和 twitter。
我遵循了所有文档步骤,facebook 运行良好,但 twitter 无法正常运行。当我点击连接 twitter 时,它只是重定向到我的应用程序登录页面。
这是我的配置:
路由.yml:
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
facebook_login:
pattern: /login/check-facebook
twitter_login:
pattern: /login/check-twitter
安全性.yml:
providers:
fos_userbundle:
id: fos_user.user_provider.username_email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
oauth:
resource_owners:
facebook: "/login/check-facebook"
twitter: "/login/check-twitter"
login_path: /login
failure_path: /login
oauth_user_provider:
service: hwi_oauth.user.provider.fosub_bridge
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
logout: true
anonymous: true
access_control:
- { path: ^/connect, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, role: ROLE_ADMIN }
- { path: ^/panel, role: ROLE_USER }
配置.yml:
hwi_oauth:
firewall_name: main
resource_owners:
facebook:
type: facebook
client_id: %oauth.facebook.client_id%
client_secret: %oauth.facebook.client_secret%
scope: "email"
options:
display: popup
twitter:
type: twitter
client_id: %oauth.twitter.client_id%
client_secret: %oauth.twitter.client_secret%
scope: ""
fosub:
username_iterations: 5
properties:
facebook: facebookId
twitter: twitterId
parameters:
hwi_oauth.user.provider.fosub_bridge.class: MyProject\UserBundle\Security\User\Provider\OauthProvider
有谁知道我错过了什么?