Hybridauth - PHP - Facebook returned an invalid user id

后端 未结 3 897
萌比男神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:56

    Maybe your configuration sends KEY instead of ID:

    Facebook Example:

    "keys"    => array ( "id" => "PUT_YOURS_HERE", "secret" => "PUT_YOURS_HERE" )
    

    Twitter Example:

    "keys"    => array ( "key" => "PUT_YOURS_HERE", "secret" => "PUT_YOURS_HERE" )
    
    0 讨论(0)
  • 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',
    
    0 讨论(0)
  • 2020-12-11 17:14

    It is due to api change of facebook graph api, you can download latest version of Hybridauth for facebook https://github.com/hybridauth/hybridauth, currently third party api is not available for facebook so you need to download facebook sdk and place it under thirdparty directory, you can download it from https://github.com/facebook/php-graph-sdk.

    After downloading you may need to configure facebook sdk auto-load files.

    0 讨论(0)
提交回复
热议问题