FB_Ignited方法fb_feed需要哪个权限?

时间:2014-02-06 15:30:35

标签: php facebook codeigniter facebook-graph-api

在这段时间里,我将Facebook Ignited库应用于我的应用程序Public Ads。 Facebook连接/登录没有问题。但是,当我想在每次获得结果时将客户广告发布到他们的Facebook时间线时:

FB应用程序的范围仅限电子邮件

fb_feed() - Facebook::api() exception caught: (#200) The user hasn't authorized the application to perform this action

with scope publish_actions

fb_feed() - Facebook::api() exception caught: An unknown error has occurred.

我犯错误的地方?方法fb_feed('post')需要哪些范围权限?

这是我的代码:

$params = array(
    "message" => "Message for customer's friends",
    "link" => "http://www.mywebpage.com/ads/iphone4s/12312",
    "picture" => "http://image.mywebpage.com/lHkOsiH.png",
    "name" => "Sample title for ad",
    "caption" => "www.mywebpage.com",
    "description" => "Sample text of customer ad."
);

try {
    $this->fb_me = $this->fb_ignited->fb_get_me();
} catch(FBIgnitedException $e) {
    echo $e->getMessage();
}

if ($this->fb_me) {
    try {
        $feed_id = $this->fb_ignited->fb_feed('post',null, $params);
    } catch(FBIgnitedException $e) {
        echo $e->getMessage();
    }
}

1 个答案:

答案 0 :(得分:0)

在范围参数中进行身份验证时,这需要扩展权限publish_stream。

所以你需要添加范围publish_stream而不仅仅是电子邮件

https://developers.facebook.com/docs/php/howto/postwithgraphapi/

https://developers.facebook.com/docs/reference/login/extended-permissions/

这是一篇很好的文章,可以看到不同的范围,哪一个优先于其他

http://globalspin.com/2013/06/publish_stream-vs-publish_actions/