Hybridauth - PHP - Facebook 返回无效的用户 ID
好吧,我从两周前开始使用 facebook 正确登录了 hybridauth,我没有任何改变,今天早上我发现它不起作用.我试图将 facebook 应用程序(id 和密钥)切换到另一个之前也可以使用的应用程序,但仍然发生同样的情况.我还尝试运行了 hybridauth 附带的示例,但它们都不起作用,所以我知道这不是我这边的配置,也不是 Facebook 应用程序的配置.
这是我尝试登录时告诉我的信息:
错误!认证失败.用户已取消身份验证或提供商拒绝连接.
原始错误消息:身份验证失败!Facebook 返回了无效的用户 ID.
- 是否会发生与我的服务器相关的事情?
- Facebook 在过去 24 小时内是否对其 API 进行了任何更改?
- 有人做过类似的实验吗?
更新:我从 1 周前开始使用它,为了让它工作,我之前(不到 1 个月前)发现其他人遇到了同样的问题,他们在 17 天前通过更新 Facebook PHP SDK 修复了它.
这是指向 GitHub 的链接,您可以在其中查看解决此问题的更改:
https://github.com/F21/hybridauth/commit/3b115e3abb5afbf44c37082e63aa8c/p>
有了这个,我设法让一切正常工作,但即使进行了这些更改(工作一周后),现在也会发生同样的错误.
解决方案我遇到了类似的问题,我相信在我的情况下我找到了解决方案,也许它会帮助其他人.(CURLOPT_CONNECTTIMEOUT)
HybridAuth 错误(无效用户)非常普遍,基本上它会查看 curl 是否返回某些内容,如果没有,则给出该错误,但错误消息中看不到真正的原因.
我最终做的是下载 facebook php sdk 并使用默认示例 https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php
(更改了我的应用程序的密钥)
那时我能够看到以前使用 HybridAuth 时未显示的新错误消息
PHP 致命错误:未捕获的 CurlException:6:名称查找超时
这让我看到了这篇文章 http://Milkcodes.blogspot.com/2010/12/php-fatal-error-uncaught-curlexception.html 谈到增加 base_facebook.php 中 CURL 的超时时间,我做到了,瞧!又开始工作了.
许多帖子的根本问题是 CURL 连接主要是造成这些问题(https、超时、nslookup 等)的原因.
快速解决问题的一个好方法是保留带有 fb sdk 的测试脚本以方便调试.
在 base_facebook.php 中第 133 行
public static $CURL_OPTS = array(CURLOPT_CONNECTTIMEOUT =>30,CURLOPT_RETURNTRANSFER =>真的,CURLOPT_TIMEOUT =>60,CURLOPT_USERAGENT =>'facebook-php-3.2',
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',
相关文章