Facebook页面发布 - 类型:OAuthException,代码:2

时间:2014-10-14 19:27:58

标签: ruby-on-rails facebook koala

我正在尝试使用Koala / Graph API测试我的应用中的页面发布。

我已经过authed并持有用户页面access_token,如下所示:

def facebook
        @vendor = current_vendor
        uid = request.env["omniauth.auth"]["uid"]
        fb_token = request.env["omniauth.auth"]["credentials"]["token"]

        @graph = Koala::Facebook::API.new(fb_token)
        pages = @graph.get_connections("me", "accounts")

        first_page_token = pages.first['access_token']

        @vendor.update_attributes(uid: uid, fb_token: fb_token, fb_page_token: first_page_token)

        redirect_to vendors_dashboard_path
end

我可以确认此方法在检入控制台和日志后正确设置属性。

当我去测试帖子到页面时:

def post_to_facebook
    @graph = Koala::Facebook::API.new(current_vendor.fb_page_token)
    object = @graph.get_object('me')
    puts object # confirmed in the server logs that this object is the page.
    @graph.put_wall_post("feed test")
    flash[:success] = "Posted to Facebook."
    redirect_to :back
end

这导致:

type: OAuthException, code: 2, message: An unexpected error has occurred. Please retry your request later. [HTTP 500]

我有发布,管理页面和读取权限(由Facebook测试用户授权后授予)。

为什么我不能发布到用户页面?

1 个答案:

答案 0 :(得分:1)

几个小时的浪费令人沮丧。出于某种原因,在测试此功能时,应用程序必须向公众开放。这看起来很奇怪 - 为什么测试用户创建的页面是公开可见的?我测试了作为个人发布,作为页面上的个人等,并且从未需要Facebook应用程序是“直播”。这样的东西通常与使用Facebook的课程相提并论。

虽然容易修复:

开发人员信息中心 - >选择您的应用 - >现状&评论 - >让您的应用“直播”。

相关问题