在HWIOAuthBundle中没有得到响应

时间:2015-07-22 13:20:11

标签: php symfony hwioauthbundle

我已成功安装HWIOAuthBundle。我用这个捆绑包登录Facebook。成功登录后,我得不到回复。我看到一个空白的屏幕。

我的配置文件是:

hwi_oauth:
    firewall_name: secured_area
    resource_owners:
        facebook:
            type:          facebook
            client_id:     xxxxxxx
            client_secret: xxxxxxx
            scope:         "email"
            infos_url:     "https://graph.facebook.com/me?fields=id,name,email,picture.type(square)"
            paths:
                email:          email
                profilepicture: picture.data.url    

我的安全档案是:

security:
    providers:
        hwi:
            id: hwi_oauth.user.provider

    firewalls:
        secured_area:
            anonymous: ~
            oauth:
                resource_owners:
                    facebook:      "/login/check-facebook"
                login_path:        /login
                use_forward:       false
                failure_path:      /login


                oauth_user_provider:
                    service: hwi_oauth.user.provider

    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }

我的路由文件是:

hwi_oauth_redirect:
    resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
    prefix:   /connect

hwi_oauth_login:
    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
    prefix:   /login


facebook_login:
    path: /login/check-facebook

google_login:
    path: /login/check-google

custom_login:
    path: /login/check-custom

1 个答案:

答案 0 :(得分:0)

在您的配置中尝试此操作:

security:
    providers:
        hwi:
            id: hwi_oauth.user.provider

    firewalls:
        secured_area:
            anonymous: ~
            oauth:
                resource_owners:
                    facebook:      "/login/check-facebook"
                login_path:        /login
                use_forward:       false
                failure_path:      /login
                #new line here
                default_target_path: / #or something else /profile etc.

                oauth_user_provider:
                    service: hwi_oauth.user.provider

    access_control:
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }