Hybridauth - PHP - Facebook returned an invalid user id
Asked Answered
W

3

10

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 the facebook app (id and secret key) to another one which was also working before, but is still happening the same. I also tried to run the examples which comes with hybridauth, and they are not working neither, so i know is not per a configuration from my side, and neither from the facebook app configuration.

This is what is telling me when i try to login:

Error! Authentification failed. The user has canceled the authentication or the provider refused the connection.

Original error message: Authentification failed! Facebook returned an invalide user id.

  • Can be happening per something related with my server?
  • Has facebook done any change on their API during the last 24 hours?
  • Any one has experimented something similar?

UPDATED: I have it working just since 1 week ago, to get it working I found other people with the same problem before (less than 1 month ago), they fixed it 17 days ago by updating the Facebook PHP SDK.

Here is the link to GitHub where you can see the changes to fix this problem:

https://github.com/F21/hybridauth/commit/3b115ee3abb5afbf44c37082e63aa8b056bf550c

With this, I managed to get everything working, but now is happening the same error even with these changes (after one week working).

Wilkey answered 28/12, 2012 at 10:55 Comment(5)
did you found the solution to this problem? I'm having the same problemFowl
anyone find a solution to this? Some of our users are experiencing this issue.Jedda
After some research I got it working:) Make sure your FB app is not in "sandbox" mode.Jedda
The app configuration in Facebook should have sandbox OFF.Rokach
Also, I had to make sure "Embedded browser OAuth Login" was DISABLED.Cropland
N
2

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',
Nicolle answered 7/3, 2013 at 14:23 Comment(0)
G
0

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" )
Gratis answered 22/8, 2014 at 18:2 Comment(0)
N
0

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.

Nutgall answered 30/3, 2017 at 12:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.