关闭
doufen3091 2015-09-06 05:34
浏览 65
已采纳

在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 06: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

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

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部