如何获得Facebook应用程序的publish_stream权限?
我有一个已经运行了一段时间的应用程序,它只请求一些帐户信息用于登录目的。现在我想用它发布到流。我已将publish_stream 添加到req_perms,但是它仍然不请求该权限。
我错过了什么吗?
<?php
# CREATE FACEBOOK BUTTON
$facebook = new Facebook(array(
'appId' => FACEBOOKAPPID,
'secret' => FACEBOOKSECRET,
'cookie' => false,
));
$fb_session = $facebook->getUser();
$fb_me = null;
// Session based API call.
if ($fb_session) {
try {
$fb_uid = $fb_session;
$fb_me = $facebook->api('/me');
$fb_me['photo'] = 'http://graph.facebook.com/'.$fb_uid.'/picture?type=large';
$_SESSION['login_api'] = 1;
$_SESSION['login_api_details'] = $fb_me;
$_SESSION['login_api_user_id'] = $fb_uid;
# WE ARE GOOD TO GO, LETS GET THE ACCESS TOKEN
$_SESSION['access_token'] = $facebook->getAccessToken();
#header_redirect(SITEURL.'/login');
} catch (FacebookApiException $e) {
error_log($e);
}
}
else{
# LOGIN URL FOR FACE BOOK & request extra stuff
$fb_login_url = $facebook->getLoginUrl(array('req_perms'=>'publish_stream,email,user_about_me,user_birthday,user_website'));
header_redirect($fb_login_url);
}
?>
I have an app which has been running for a while which has only requested some account information for login purposes. Now I want to use it to publish to the stream. I have added publish_stream to the req_perms but, it still doesn't ask for that permission.
Am I missing something?
<?php
# CREATE FACEBOOK BUTTON
$facebook = new Facebook(array(
'appId' => FACEBOOKAPPID,
'secret' => FACEBOOKSECRET,
'cookie' => false,
));
$fb_session = $facebook->getUser();
$fb_me = null;
// Session based API call.
if ($fb_session) {
try {
$fb_uid = $fb_session;
$fb_me = $facebook->api('/me');
$fb_me['photo'] = 'http://graph.facebook.com/'.$fb_uid.'/picture?type=large';
$_SESSION['login_api'] = 1;
$_SESSION['login_api_details'] = $fb_me;
$_SESSION['login_api_user_id'] = $fb_uid;
# WE ARE GOOD TO GO, LETS GET THE ACCESS TOKEN
$_SESSION['access_token'] = $facebook->getAccessToken();
#header_redirect(SITEURL.'/login');
} catch (FacebookApiException $e) {
error_log($e);
}
}
else{
# LOGIN URL FOR FACE BOOK & request extra stuff
$fb_login_url = $facebook->getLoginUrl(array('req_perms'=>'publish_stream,email,user_about_me,user_birthday,user_website'));
header_redirect($fb_login_url);
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的其他地方试试这个
Try this in your else