2016-06-17 165 views
0

http://localhost/app_dev.php/login/facebook後,我有這樣的錯誤:錯誤在發送HTTP請求

[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的信息。

感謝您的幫助:)

+0

當我查看[本站點](https://github.com/hwi/HWIOAuthBundle)時,在顯示文檔的底部,它說Symfony支持小於3.0。 –

回答

0

在您的應用程序/配置/ routing.yml中你有:

facebook_login: 
    path: /login/check-facebook 

而且在應用程序/配置/ security.yml添加這個太:

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

請檢查那些。

+0

是的,我配置了路由和訪問控制。 – n1c01a5

+0

您可以發佈導致問題(第29行)的「vendor/kriswallsmith/buzz/lib/Buzz/Client/Curl.php」中的代碼。我不確定這是否是您的文件? –

+0

你可以在github中看到代碼。這是一個symfony包。 – n1c01a5