发送http请求时出现HWIOAuthBundle错误

时间:2018-04-11 13:59:26

标签: php symfony hwioauthbundle

我用

    "symfony/symfony": "~2.8",
    "hwi/oauth-bundle": "0.4.*@dev",
    "friendsofsymfony/user-bundle": "~2.0"

并且第一次尝试进入社交网络我有错误:

CRITICAL - Uncaught PHP Exception HWI\Bundle\OAuthBundle\OAuth\Exception\HttpTransportException: "Error while sending HTTP request" at /home/myproject/vendor/hwi/oauth-bundle/OAuth/ResourceOwner/AbstractResourceOwner.php line 257 

但是当尝试返回并再试一次 - 一切都好, 提供者的问题识别,

我添加到配置verify_peer: false,但首次输入时仍有错误 我的配置:

hwi_oauth:
    http_client:
        verify_peer: false
    connect:
        account_connector: optima_oauth_provider
    firewall_names: [main]
    resource_owners:
        facebook:
            type:                facebook
            client_id:           "%facebook_app_id%"
            client_secret:       "%facebook_app_secret%"
            scope:               "email"
            options:
                display: popup
            infos_url:     "https://graph.facebook.com/me?fields=id,link,name,first_name,last_name,email,picture.type(square)"
            paths:
                email:          email
                profilepicture: picture.data.url
        google:
            type:                google
            client_id:           "%google_app_id%"
            client_secret:       "%google_app_secret%"
            scope:               "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"

1 个答案:

答案 0 :(得分:0)

https://curl.haxx.se/docs/caextract.html下载cacert.pem,放在任何位置并编辑php.ini

curl.cainfo = "/any/location/cacert.pem"

然后重新启动您的Web服务器。