doufen3091 2015-09-06 13:34
浏览 64
已采纳

在Facebook Wall发布,作为页面 - 给出错误

I'm having trouble to be able to post on my business page as page itself.

Right now I have:

<?php
require_once("facebook.php");

$config = array();
$config['appId'] = '446766585xxxxxx'; <-- APP ID
$config['secret'] = '6fc8646c63b5356b5264d73f0fxxxxxx'; <--- APP SECRET
$config['fileUpload'] = false; // optional

$fb = new Facebook($config);

$params = array(
  "access_token" => "XXXXXX", <--- PAGE ACCESS TOKEN OR APP ACCESS TOKEN
  "message" => "Hello",
  "link" => "http://www.example.com",
  "picture" => "http://example.com/images/8.jpg",
  "name" => "Completed",
  "caption" => "www.example.com",
  "description" => "Description here."
);


try {
  $ret = $fb->api('/113928402609xxxx/feed', 'POST', $params); <-- PAGE ID I HAVE HERE
  echo 'Successfully posted to Facebook';
} catch(Exception $e) {
  echo $e->getMessage();
}
?>

The issue is , if I change the access token to the access token of the App - I keep posting as a user and not as the page...

If I set the access token to be the Page access token with the necessary permissions(manage_pages, manage_accounts, user_events)

I get the error "Invalid appsecret_proof provided in the API argument "

What am I missing here?

  • 写回答

1条回答 默认 最新

  • dongzaizai2015 2015-09-06 14:14
    关注

    First of all, publish_pages is needed to post as page, and there is no manage_accounts permission. Always refer to the API reference to find out which permissions you need. It´s not a guessing game, the reference will tell you exactly what to do.

    About that error, you may have activated appsecret_proof in the App settings: https://developers.facebook.com/apps/[your-app-id]/settings/advanced/ ("Require App Secret")

    You can either deactivate it, or you can transmit an appsecret_proof parameter to your API calls. More information: https://developers.facebook.com/docs/graph-api/securing-requests#appsecret_proof

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题