0

搜索并发现 /me/accounts/不再可用,过去我使用它,所以我使用该 Gist在页面的应用程序上发布没有任何问题,

但是我删除了该应用程序并尝试添加另一个新应用程序,将代码更改为:

class MainHandler(BaseHandler, tornado.auth.FacebookGraphMixin):
    @tornado.web.authenticated
    @tornado.web.asynchronous
    def get(self):
        self.facebook_request("/me/applications/developer/", self._on_accounts, access_token=self.current_user["access_token"])

    def _on_accounts(self, account):
        if account is None:
            # Session may have expired
            print "on accounts failed"
            sys.exit()

        print "here we go!"
        print account # this will return me a json
        for acc in account["data"]:
            if acc["id"] == "157547381099830":
                self.facebook_request("/157547381099830/feed", post_args={"message":"hi there!", "link": "http://www.example.com"}, access_token=self.current_user["access_token"], callback=self.async_callback(self._on_page_post))

我能做的,只是在我的墙上发帖(更改self.facebook_request("/157547381099830/feed"...self.facebook_request("/me/feed"... 我进入页面,Facebook 知道那是管理员,但如果我使用 python 代码,它将以普通用户的身份发布流!

编辑:似乎问题出在 Facebook 的新规则上?当切换到我的名字时,我不能在墙上发布,即使我是管理员?

在管理设置中是这样写的:

经理 Abdelouahab 可以管理管理员角色、发送消息并作为主页创建帖子、创建广告和查看见解。

但是,似乎并非如此,因为当我选择时:

您以 Abdelouahab Abdenour Aliane 的身份发布、评论和喜欢 - 更改为 Essog 社区然后我可以发布,只有当我切换到Essog 社区时(因为我阻止了外部用户在墙上发帖)。

更新:添加manage_pages到范围,甚至这不起作用

4

1 回答 1

0

抱歉,找到了答案:

  1. 第一次使用manage_pages,所以我使用了页面令牌!
  2. 我必须获取页面访问令牌而不是用户令牌!

要以 Page 而非当前用户的身份执行以下操作,您必须使用 Page 的访问令牌,而不是通常用于读取 Graph API 对象的用户访问令牌

(删除并开始新页面)

这将起作用:

for acc in account["data"]:
    if acc["id"] == "345632575539519":
        print acc["access_token"]
        self.facebook_request("/345632575539519/feed", post_args={"message":"hello", "link": "http://www.example.com"}, access_token=acc["access_token"], callback=self.async_callback(self._on_page_post))
于 2013-06-18T01:45:59.913 回答