facebook login, getuser not working properly

我只是一个虾纸丫 提交于 2019-12-11 05:47:08

问题


I'm trying to add a facebook login to my site but the problem is that the facebook function "getUser" only works sometimes. Half the time I'll get the user's facebook id from it, but half the times I won't.

Is there a delay somewhere? How can I fix this?

My if facebook_uid set fails and it all ends up in a big mess. :(

Facebooks getSession never fails though. All the above happens when a facebook session is correctly initiated.

Please help!

Here's part of my code:

$facebook = new Facebook(array('appId' => '123','secret' => '789','cookie' => true,));
$facebook_session = $facebook->getSession();
if ($facebook_session) $_SESSION['facebook_uid'] = $facebook->getUser();

来源:https://stackoverflow.com/questions/5951356/facebook-login-getuser-not-working-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!