我有一个小的facebook脚本应该获得user_about_me,publish_actions,publish_stream权限。我在我的应用中设置了这些权限
我的代码看起来像这样:
<?php
require_once("src/facebook.php");
$config = array();
$config['appId'] = 'xxx';
$config['secret'] = 'xxx';
$facebook = new Facebook($config);
//2. retrieving user
$user = $facebook->getUser();
//3. requesting 'me' to API
$me = null;
if ($user) {
try {
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
//4. login or logout
if ($me) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
?>
<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>php-sdk</title>
</head>
<body>
<?php if ($me): ?>
<?php echo "Welcome, ".$me['first_name']. ".<br />"; ?>
<a href="<?php echo $logoutUrl; ?>">
Logout
</a>
<?php else: ?>
<a href="<?php echo $loginUrl; ?>">
Login
</a>
<?php endif ?>
</body>
</html>
但是当我通过Facebook登录时,它只会请求基本信息,而不是发布权限。
怎么了?