如何通过自定义应用程序获取访问令牌代表Facebook页面?

问题描述:


我发现以下解决方案非常有用,所以我以为我应该分享它!


要通过Facebook应用程序发布到Facebook页面,您需要获得用于应用程序使用的Facebook页面的访问令牌(具有所需权限)。要获得这一点,请登录到您的Facebook帐户,然后转到 Graph API Explorer 。在资源管理器中:

To post to a facebook page via a facebook application, you need to get the access token (with the required permissions) of the facebook page meant for the application use. To get this, login to your facebook account and goto the Graph API Explorer. In the explorer:


  1. 提交此网址: https://graph.facebook.com/me/accounts '(在应用程序页面的url字段中)

  1. Submit this url: https://graph.facebook.com/me/accounts' (in the url field, inside the app. page.)

选择您想要做的事情的应用程序(发布,如等)。

Select the application on behalf of which you want to to do things(post,like, etc.).

点击获取访问令牌(如果没有)获取它。

Click Get Access Token (if you don't have one) to get it.

选择授予此应用程序的权限。 : publish_stream offline_access & manage_pages (发布到页面墙上的帖子)

Select the permissions to grant to this app. : publish_stream, offline_access & manage_pages ( for posting to page wall post).

您将在Facebook上看到您的实体(或图形对象)的列表,如fb页面或应用程序及其访问令牌。此外,对于您将找到的页面,查询应用程序对该页面的权限。

You will see a list of your entities (or graph objects) on facebook, such as an fb page or an app along with their access tokens. Also, for a page you will find, the permissions the querying application has for the page.

现在,查询应用程序可以代表页面(或任何对象)通过使用对象的id及其访问令牌

Now the querying application can operate on behalf of the page (or any object) by using the object's id and their access token.