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).
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',
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" )
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.
来源:https://stackoverflow.com/questions/14068425/hybridauth-php-facebook-returned-an-invalid-user-id