永不过期的Facebook页面访问令牌

问题描述:

我一直试图找到一种创建永不过期的FaceBook页面访问令牌的方法.我看到了一个选项,您可以在其中提供代替令牌的AppID | AppSecret,但是这要求您提交应用程序以供批准,facebook似乎不理解使用令牌的其他应用程序的概念.无论如何,请参见下面的答案,了解我如何找到一种方法.

I have been trying to find a way to create a never expiring FaceBook Page Access Token. I have seen the option where you provide the AppID|AppSecret in place of the token however that requires you to submit the app for approval and facebook does not seem to understand concept of OTHER apps using the token. Regardless, see the answer below for how I found a way to do this.

在将许多不同的解决方案拼凑在一起之后,我做到了,而且似乎可行.我假设您只需要一个页面的令牌,并且您已经设置了Facebook应用程序页面.

After piecing together many different solutions - I did this and it seems to work. I assume you only want a token for a single page and that you already have your Facebook app page setup.

  1. 通过从Web浏览器导航到页面ID,单击页面左侧菜单列表中的关于"链接,然后滚动到关于"信息的底部,您将参见页面ID显示.

  1. Get the ID of the page by navigating to it from a web browser, click on About link in the menu list down the left hand side of the page, then scroll to the bottom of the About information and you will see the Page ID display.

导航到 Facebook Graph API Explorer

在浏览器的这一行中删除API版本(在本例中为v3.2)之后的所有内容

Remove everything after the API Version (in this case v3.2) on this line of the explorer

并将其替换为123456789?fields = access_token,其中123456789是您的页面ID.

and replace it with 123456789?fields=access_token where 123456789 is your page ID.

  1. 在您刚刚输入文字的行的右侧单击提交"按钮.

  1. Click the Submit button to the right hand side of the line you just entered the text into.

  1. 您将在屏幕底部的响应中收到一个令牌,其外观类似于以下内容:

{ "access_token":"TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", "id":"1755746091324056" } TTTTTTTT是您的访问令牌.

{ "access_token": "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", "id": "1755746091324056" } where TTTTTTTT is your access token.

  1. 仅从响应中复制令牌(不带引号),然后将其粘贴到页面顶部的访问令牌"字段中,以替换以前的访问令牌.

  1. 粘贴新的访问令牌后,单击访问令牌左侧的蓝色信息图标.

  1. After pasting in the new access token click on the blue information icon to the left of the access token.

在访问令牌信息"对话框中,单击对话框右下方的在访问令牌工具中打开"按钮.

In the Access Token Information dialog, click on the 'Open in Access Token Tool' button at the bottom right of the dialog.

  1. 在将打开的访问令牌调试器中,单击页面底部的扩展访问令牌"按钮.应该显示一个新的访问令牌,并且其上方的文本应说明该令牌永不过期.

我希望这会有所帮助.

PS-当我将使用此方法生成的令牌粘贴到其中时,这就是我在Facebook的访问令牌工具中看到的内容.它说这个令牌永远不会过期.

PS - Here is what I see in Facebook's Access Token tool when I paste the token generated using this method into it. It says this token will never expire.