简体   繁体   English

Hybridauth - PHP - Facebook返回了无效的用户ID

[英]Hybridauth - PHP - Facebook returned an invalid user id

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. 好吧,我有两个星期前使用facebook工作并正确登录hybridauth,我没有任何改变,今天早上我发现它无法正常工作。 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. 我试图将facebook应用程序(id和密钥)切换到另一个之前也在工作的应用程序,但仍然在发生相同的情况。 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. 我也尝试运行hybridauth附带的示例,它们也没有工作,所以我知道不是来自我身边的配置,也不是来自facebook app配置。

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. Facebook返回了一个荣耀的用户ID。

  • Can be happening per something related with my server? 每个与我的服务器相关的东西都可以发生吗?
  • Has facebook done any change on their API during the last 24 hours? Facebook在过去24小时内对其API进行了任何更改吗?
  • 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. 更新:我从1周前开始工作,为了让它工作我发现其他人之前(不到1个月前)有相同的问题,他们通过更新Facebook PHP SDK修复了17天前。

Here is the link to GitHub where you can see the changes to fix this problem: 以下是GitHub的链接,您可以在其中查看更改以解决此问题:

https://github.com/F21/hybridauth/commit/3b115ee3abb5afbf44c37082e63aa8b056bf550c 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) (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. HybridAuth错误(无效用户)非常通用,基本上它看起来curl是否返回一些东西,如果没有,则给出该错误,但真正的原因在错误消息中不可见。

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 我最后做的是下载facebook php sdk并使用默认示例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 此时,我能够看到使用HybridAuth之前未显示的新错误消息

PHP Fatal error: Uncaught CurlException: 6: name lookup timed out PHP致命错误:未捕获的CurlException:6:名称查找超时

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! 这让我想到了这篇文章http://milkcodes.blogspot.com/2010/12/php-fatal-error-uncaught-curlexception.html ,它讨论了我在base_facebook.php中增加了CURL的超时问题,我和Voila! started working again. 再次开始工作。

The underlying issue in many posts is that CURL connectivity is mostly responsible for these issues (https, timeout, nslookup, etc..) 许多帖子中的根本问题是CURL连接主要负责这些问题(https,timeout,nslookup等)。

A good way to quickly figure it out is by keeping a test script with fb sdk handy for debugging. 快速解决问题的一个好方法是使用fb sdk保存测试脚本以便进行调试。

in base_facebook.php around line 133 在第133行的base_facebook.php中

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: 也许您的配置发送KEY而不是ID:

Facebook Example: Facebook示例:

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

Twitter Example: Twitter示例:

"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 . 这是由于facebook图api的api更改,你可以下载最新版的Hybridauth为facebook https://github.com/hybridauth/hybridauth ,目前第三方api不适用于facebook所以你需要下载facebook sdk和地方在第三方目录下,您可以从https://github.com/facebook/php-graph-sdk下载。

After downloading you may need to configure facebook sdk auto-load files. 下载后,您可能需要配置facebook sdk自动加载文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HybridAuth Facebook返回了无效的用户ID - HybridAuth Facebook returned an invalid user id Hybridauth身份验证失败! Facebook返回了无效的用户ID - Hybridauth Authentication failed! Facebook returned an invalid user id HybridAuth:身份验证失败! LinkedIn返回了无效的令牌 - HybridAuth: Authentication failed! LinkedIn returned an invalid Token octoberCMS中的flynsarmy-sociallogin(Facebook api)-身份验证失败! Facebook返回了无效的用户ID - flynsarmy-sociallogin (Facebook api) in octoberCMS - Authentication failed! Facebook returned an invalid user id HybridAuth Facebook-“更新用户状态失败!” - HybridAuth Facebook - 'Update user status failed!' 验证失败! Facebook在Yith社交登录wordpress上返回了无效的用户ID - Authentication failed! Facebook returned an invalid user id on Yith social login wordpress 如何在PHP的HybridAuth中从Facebook和Google注销 - How to logout from facebook and google in hybridauth in php 没有Facebook用户ID返回。 为什么? - No Facebook User ID returned. Why? Yii hybridauth失败,包括“ User.php” - Yii hybridauth fails including “User.php” Yii-Hybridauth-如何导入Facebook用户的联系人列表 - Yii - Hybridauth - How to import contact list of facebook user
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM