如何在Facebook中获得非到期access_token? [英] How to get non expiring access_token in Facebook?

查看:1626
本文介绍了如何在Facebook中获得非到期access_token?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面 https://developers.facebook.com/tools/explorer,我的应用程序可以发布在Facebook Page的墙上。



然而 access_token 在一小时后过期



如何获得不到期的 access_token



编辑:向下选民:我已经发布了自己的答案,如果你阅读它,你会知道我的解决方案从来没有在FB文档或者SO中找到。

解决方案

对于所有投票和投票的人,我想告诉你,在这里没有明确的答案。



经过这么多的痛苦试图弄清楚FB的混乱文件,这个问题的答案是非常简单的:


  1. 将您的应用设置为本机/桌面,以便您可以获得60天的令牌(稍后将其改为永久性)。请执行以下操作:转到 https://developers.facebook.com/apps/ 编辑设置>高级>在应用程序类型中选择本机/桌面。


  2. 转到 https://developers.facebook.com/tools/explorer/ 选择您的应用程序,然后获取访问令牌


  3. 扩展权限标签中,选择 manage_pages publish_stream / p>


  4. 现在你有一个60天的临时令牌。


  5. ,请转到此处使用您的临时令牌: https://graph.facebook.com/me/accounts?access_token=REPLACE_THIS_WITH_YOUR_TEMPORARY_TOKEN


看来,您将看到永久访问令牌到您是管理员的所有Facebook页面。


I get my access token in page https://developers.facebook.com/tools/explorer and my app is able to post on a Facebook Page's wall.

However the access_token expires after an hour.

How can I get a non-expiring access_token?

Edit: Down voters: I've posted my own answer and if you read it you'll know that my solution is never found in the FB docs nor in SO.

解决方案

To all those who down voted and voted for close, I want to let you know that there is no clear answer here on SO.

After so much pain trying to make sense of FB's confusing docs, the answer to this question is rather extremely simple:

  1. Set your app to Native/Desktop so you can get a 60-day token (you'll turn this to permanent later). Do this by going to https://developers.facebook.com/apps/ Edit settings > Advanced > Choose Native/Desktop in the App type.

  2. Go to https://developers.facebook.com/tools/explorer/ select your app, and Get Access Token

  3. In the Extended Permissions tab, select manage_pages and publish_stream

  4. Now you have a 60-day temporary token.

  5. To get your permanent token, go here and use your temporary token: https://graph.facebook.com/me/accounts?access_token=REPLACE_THIS_WITH_YOUR_TEMPORARY_TOKEN

Behold, you will see permanent access token to all Facebook pages which you are an admin.

这篇关于如何在Facebook中获得非到期access_token?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆