douyan1972 2011-06-10 17:56
浏览 28
已采纳

Facebook在没有publish_stream权限的情况下发布到我的Page Wall

I have a web app that allows people to register directly or by using their facebook credentials through the facebook registration plugin. I want to be able to duplicate information posted on the website to my website's facebook fan page. So far if I have a user that is not logged into facebook, it will post to my Page's wall no problem showing that it came from my website app. But if the person is logged into facebook, but has not granted my app the publish_stream permission I get a permissions error. Is there anyway to simply force the post to come from my website app if I don't have the proper permission with the user? I would be happy if every post on my facebook page came from the app and never from the user, but I simply can't find any documentation showing how this is done or if it even can be done.

EDIT

Here is the code I am using that will allow me to post to my own wall if the person is not logged into facebook. I have already authorized the app to post.

$attachment = array('message' => $notes,
                    'name' => 'Backcountryride.com',
                    'caption' => "Community Driven Transportation",
                    'link' => 'http://backcountryride.com',
                    'description' => $description,
                    'picture' => 'http://backcountryride.com/images/vanlogo.jpg'
                    );
    $result = $facebook->api('/backcountryride/feed/','post',$attachment);

EDIT2

Here is the code I use to instantiate the $facebook object:

$facebook = new Facebook(array(
  'appId'  => FACEBOOK_APP_ID,
  'secret' => FACEBOOK_SECRET,
  'cookie' => true,
));

$session = $facebook->getSession();

$me = null;
// Session based API call.
if ($session) {
  try {
    $uid = $facebook->getUser();
    $me = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
  }
}

Thank you!

  • 写回答

3条回答 默认 最新

  • dougan7657 2011-06-12 03:44
    关注

    What you are looking for is an "app login". You can get a session for your app instead of the user. Not easy to find, I stumbled across it a few weeks ago. Then you just use the functions you normally use, but with your "app" session instead of a "user" session.

    https://developers.facebook.com/docs/authentication/#app-login

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值