I am settting up FOSUserBundle and HWIOAuthBundle("0.3.*@dev") to work with facebook and twitter.
I followed all documentation steps and facebook is working well but twitter doesn't work correctly. When I click to connect with twitter, it just redirects to my app login page.
Here are my configs:
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
Does anyone knows what I am missing?
The problem was the twitter callback url which was not configured in the twitter app config. After setting one callback url, it worked correctly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.