我有一个非常简单的PHP应用程序,检索用户&朋友RSVPd事件使用FQL。它使用最新的PHP SKD。当我登录并身份验证为创建应用程序的帐户时,代码工作完美,但如果我登录并身份验证为其他人,则会出现"未知错误"。
这是我的代码的登录部分
$config = array();
$config['appId'] = $validId;
$config['secret'] = $validSecret;
$facebook = new Facebook($config);
$uid = $facebook->getUser();
// get the url where to redirect the user
$location = "". $facebook->getLoginUrl(array('scope' => 'user_events, friends_events'));
// check if we have valid user
if ($uid) {
try {
$fb_user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
$fb_user_id = NULL;
// seems we don't have enough permissions
print '<script language="javascript" type="text/javascript"> top.location.href="'. $location .'"; </script>';
// kill the code so nothing else will happen before user gives us permissions
die();
}
} else {
// seems our user hasn't logged in
print '<script language="javascript" type="text/javascript"> top.location.href="'. $location .'"; </script>';
// kill the code so nothing else will happen before user gives us permissions
die();
}
print "Authenticated ". $fb_user_profile['name']." <a href='logout.php'>Logout</a><br>";
这是我的代码的FQL部分
$param = array(
'method' => 'fql.query',
'query' => $validFqlQuery,
'callback' => '',
'access_token' => $facebook->getAccessToken()
);
echo "<br>Working...";
$fqlResult = $facebook->api($param);
print_r($fqlResult);
你的应用在上线之前需要经过Facebook的审核其他用户登录
如果您的应用程序请求以下三个基本权限,则不需要经过Login Review
:
- public_profile
- user_friends
要向应用程序的用户请求任何其他权限,您需要提交审查。
然而,为了帮助你制作你的Facebook登录体验,你的应用的开发者将能够看到,并授予任何许可,而无需Facebook的审查。注意:在应用程序的角色选项卡中列出的人将具有访问权限无需经过审查就可以扩展权限(例如:Publish_actions或manage_pages)。例如,如果你使用FacebookWordpress插件发布你的博客文章到你的Facebook页面或个人资料,你不需要提交审查,只要所有你的发布者列表在应用的Roles选项卡中。