我正在建立FOSUserBundle和HWIOAuthBundle(“0.3。* @ dev”)与facebook和twitter合作。
我遵循了所有文档步骤,Facebook运行良好,但Twitter无法正常工作。当我点击与Twitter连接时,它只是重定向到我的应用登录页面。
以下是我的配置:
的routing.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
security.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 }
config.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
有谁知道我错过了什么?
答案 0 :(得分:3)
问题是twitter回调网址没有在twitter app配置中配置。设置一个回调网址后,它正常工作。