简体   繁体   中英

Symfony HWI OAuth login error behind a proxy

I am using Symfony2 with HWIOAuth Bundle to login with Facebook Google and twitter. When network connection is behind a proxy login gives following error

[2/2] HttpTransportException: Error while sending HTTP request
in vendor\\hwi\\oauth-bundle\\OAuth\\ResourceOwner\\AbstractResourceOwner.php at line 258

[1/2] RequestException: Connection timed out after 5000 milliseconds
in vendor\\kriswallsmith\\buzz\\lib\\Buzz\\Client\\Curl.php at line 29

HWIOAuthBundle depends on Buzz which uses php cURL to send requests. So you need to set proxy for cURL. Since symfony framework we can do it without getting our hands dirty. It is as easy as adding a new line to app/config/config.yml as follows.

# app/config/config.yml 
hwi_oauth:
     http_client:
         proxy: "example.com:8080"   # String with proxy configuration for cURL connections, ignored by default.
                                     # "" -> don't set proxy and will use proxy system
                                     # "example.com:8080" -> set custom proxy
                                     # ":" -> disable proxy usage, ignoring also proxy system and ENVIRONMENT variables

configuring_the_http_client.md

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM