将应用发布到页面时出现问题 [英] Problems getting app to post to a page
问题描述
我的应用程序的目标纯粹是获取在我的网站上创建的新闻项目,并让它们自动发布在我的 Facebook 页面的墙上.(不是用户,而是业务页面).我已成功将应用程序发布到我的用户墙,但存在几个问题.一方面,我需要将其发布在我的 BUSINESS 页面上,并且 access_token 已过期.我不希望它过期,它需要保持活动状态,以便我网站上的任何帖子都能继续发布到 Facebook.
The goal of my app is purely to take news items, created on my website, and have them posted on the wall of my facebook page automatically. (not a user, but a business page). I have succeeded in getting the app to post to my user wall, but there several issues with that. For one, I need it to post on my BUSINESS page, and the access_token expires. I don't want it to expire, it needs to stay active so that any post to my website will continue to post to facebook.
有人知道这样做的任何直接方法吗?让我走到这一步的是:http://nocturnsoft.com/devblog/?p=906.最后,我需要知道的两件事是如何使用图形 API 发布到业务页面,以及如何延长我的 access_token 的生命周期.
Does anybody know of any straight forward way to doing this? The on that got me this far was this: http://nocturnsoft.com/devblog/?p=906. In the end, the two things I need to know is how to post to a business page using graph API, and I need to know how to extend the life of my access_token.
谢谢
推荐答案
要实现这一点,您需要做几件事:
You need several things to achieve this:
- 作为该页面管理员的用户的活动
access_token
. 该用户授予的 manage_pages
和publish_stream
权限.- 页面
access_token
(您可以从user
对象的accounts
连接中获取)GET http://graph.facebook.com/me/accounts
(将返回用户拥有的每个页面的详细信息数组,每个页面都包含access_token
) - 通过发布创建
post
使用页面access_token
向http://graph.facebook.com/PAGE_ID/feed
发出POST
请求.
- Active
access_token
for user who is admin of that page. manage_pages
andpublish_stream
permissions granted by that user.- Page
access_token
(which you can get fromaccounts
connection ofuser
object)
GET http://graph.facebook.com/me/accounts
(will return array of details for every pages user own, withaccess_token
included for every page) - Create
post
by issuingPOST
requests tohttp://graph.facebook.com/PAGE_ID/feed
using pageaccess_token
.
正如你所说的 access_token
是可以过期的东西,你不能禁用它(这不是坏事,实际上你可以在有限的时间内,因为 offline_access
权限存在,但已弃用),但您可以按照 离线访问权限的弃用 开发者博客文章.
As you said access_token
is something that can expire, you can't disable this (and it's not something bad, actually you can for a limited time because offline_access
permission exists, but it's deprecated) but you can extend the expire period for up to 60 days as described in Deprecation of Offline Access Permission developers blog post.
这篇关于将应用发布到页面时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!