未获取 Facebook 用户 ID
我正在尝试获取当前登录并使用我的应用程序的用户的 Facebook ID,以便可以将其与其他一些信息一起写入数据库。
我自己已经测试了无数次,它会获取我的 ID 并将其写入数据库,但是如果我要求其他人使用它......它不会获取我的应用程序用户的 ID......
我是否缺少任何扩展权限?到目前为止,这就是我获取用户 ID 的全部内容。
谢谢。
<?php include ('includes/php/facebook.php'); ?>
<?php
$facebook = new Facebook(array(
'appId' => 'XXXXXXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
));
?>
<?php
$user = $facebook->getUser();
$userId = $user;
//some code here...
?>
I'm trying to get the Facebook ID of the current user logged in and using my app so that it can be written to a database along with some other information.
I've tested it countless times for myself and it will get my ID and write it to the database, but if I ask someone else to use it... It won't get the ID of the user of my application...
Am I missing any extended permissions for this? This is all I have so far to get the user id.
Thanks.
<?php include ('includes/php/facebook.php'); ?>
<?php
$facebook = new Facebook(array(
'appId' => 'XXXXXXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
));
?>
<?php
$user = $facebook->getUser();
$userId = $user;
//some code here...
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 $userID 为 0 或 null,则表示该用户未经过身份验证。
您可以从 http://developers.facebook.com/docs/reference/php/ 下载 SDK
它包含几个示例。
If $userID is 0 or null, it means that the user is not authenticated.
You can download the SDK from http://developers.facebook.com/docs/reference/php/
It contains several examples.
http://developers.facebook.com/docs/authentication/
http://developers.facebook.com/docs/authentication/