Problems getting app to post to a page

随声附和 提交于 2019-12-24 15:19:44

问题


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.

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.

Thanks


回答1:


You need several things to achieve this:

  • Active access_token for user who is admin of that page.
  • manage_pages and publish_stream permissions granted by that user.
  • Page access_token (which you can get from accounts connection of user object)
    GET http://graph.facebook.com/me/accounts (will return array of details for every pages user own, with access_token included for every page)
  • Create post by issuing POST requests to http://graph.facebook.com/PAGE_ID/feed using page access_token.

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.



来源:https://stackoverflow.com/questions/9066941/problems-getting-app-to-post-to-a-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!