【问题标题】:Which permission I need for FB_Ignited method fb_feed?FB_Ignated 方法 fb_feed 需要哪些权限?
【发布时间】:2014-02-06 15:30:35
【问题描述】:

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

仅适用于 FB 应用程序电子邮件

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

范围为 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();
    }
}

【问题讨论】:

    标签: php facebook codeigniter facebook-graph-api


    【解决方案1】:

    这需要在 scope 参数中进行身份验证时扩展权限 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/

    【讨论】:

    • 谢谢,但在获得了 publish_stream 的额外许可后,我收到了这个异常:fb_feed() - Facebook::api() 捕获到异常:发生了未知错误。
    • 所以,问题出在方法 fb_feed() 的第二个参数上。当我更改为“我”时,帖子已发送到时间线,但现在结果是:fb_feed() - Facebook::api() 返回了无效值。 :)
    猜你喜欢
    • 2014-08-28
    • 2015-12-28
    • 1970-01-01
    • 1970-01-01
    • 2023-04-06
    • 2020-04-06
    • 2016-07-15
    • 2012-03-11
    • 2019-08-23
    相关资源
    最近更新 更多