facebook login, getuser not working properly

2019-08-14 06:48发布

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();

0条回答
登录 后发表回答