发送HTTP请求时出错

时间:2016-06-17 17:44:42

标签: php oauth symfony hwioauthbundle

转到http://localhost/app_dev.php/login/facebook后发生此错误:

 [1/2] RequestException: Failed to connect to localhost port 1080: Connection refused  -

in vendor/kriswallsmith/buzz/lib/Buzz/Client/Curl.php at line 29

Uncaught PHP Exception HWI\Bundle\OAuthBundle\OAuth\Exception\HttpTransportException: "Error while sending HTTP request" at /var/www/symfony/vendor/hwi/oauth-bundle/OAuth/ResourceOwner/AbstractResourceOwner.php line 256 Context: { "exception": "Object(HWI\\Bundle\\OAuthBundle\\OAuth\\Exception\\HttpTransportException)" } 

我的config_dev.php:

# HWIOAuthBundle
hwi_oauth:
    connect:
        account_connector: hwi_oauth.user.provider.entity
    firewall_names: [secured_area]
    resource_owners:
        facebook:
            type:                facebook
            client_id:           ...
            client_secret:       ...
            options:
                display: popup #dialog is optimized for popup window
                auth_type: rerequest 
    fosub:
        username_iterations: 30
        properties:
        facebook: facebookId

我的security.yml: ...

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

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

                oauth_user_provider:
                    service: hwi_oauth.user.provider.entity

有关信息,我使用Symfony3。

感谢您的帮助:)

2 个答案:

答案 0 :(得分:0)

在你的app / config / routing.yml中你有:

facebook_login:
    path: /login/check-facebook

在app / config / security.yml中也加上这个:

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

请检查那些。

答案 1 :(得分:0)

在你的config.yml文件中的hwi_oauth中添加它。

hwi_oauth:
      http_client:
          verify_peer: false