Hybridauth - PHP - Facebook returned an invalid user id

后端 未结 3 908
萌比男神i
萌比男神i 2020-12-11 16:34

Well I had hybridauth working and login correctly using facebook since 2 weeks ago, I did not any change and this morning I found that it was not working. I tried to switch

3条回答
  •  没有蜡笔的小新
    2020-12-11 16:58

    I had a similar problem and I believe in my case I found the solution and maybe it would help someone else. (CURLOPT_CONNECTTIMEOUT)

    HybridAuth error (invalid user) is very generic, basically it looks if the curl returns something and if not, gives that error, but the real reason is not visible in the error message.

    What I ended up doing is downloading the facebook php sdk and using the default example https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php

    (Changed the keys to my app)

    At that point I was able to see new error messages that were not showing before when using HybridAuth

    PHP Fatal error: Uncaught CurlException: 6: name lookup timed out

    That pointed me to this article http://milkcodes.blogspot.com/2010/12/php-fatal-error-uncaught-curlexception.html that talks about increasing the timeout of CURL in base_facebook.php which I did and Voila! started working again.

    The underlying issue in many posts is that CURL connectivity is mostly responsible for these issues (https, timeout, nslookup, etc..)

    A good way to quickly figure it out is by keeping a test script with fb sdk handy for debugging.

    in base_facebook.php around line 133

    public static $CURL_OPTS = array(
        CURLOPT_CONNECTTIMEOUT => 30,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 60,
        CURLOPT_USERAGENT      => 'facebook-php-3.2',
    

提交回复
热议问题