从 Facebook 获取长期访问令牌 [英] Get long live access token from Facebook

查看:22
本文介绍了从 Facebook 获取长期访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,最近 Facebook 决定删除 offline_access 权限,并引入了一个称为长寿命访问令牌的概念,最长持续时间为 60 天.有没有人知道如何使用 Facebook JavaScript SDK 获取此访问令牌?

As I understand it, recently Facebook has decided to remove the offline_access permission and has introduced a concept called long-lived access tokens which last a maximum of 60 days. Is there anyone who knows how to get this access token with the Facebook JavaScript SDK?

推荐答案

有一种方法可以将此期限延长至 60 天.此处描述:https://developers.facebook.com/docs/roadmap/completed-更改/离线访问删除/场景 4:客户端 OAuth 和通过新端点延长 Access_Token 过期时间

There is a way to extend this to 60 days. described here: https://developers.facebook.com/docs/roadmap/completed-changes/offline-access-removal/ under Scenario 4: Client-side OAuth and Extending Access_Token Expiration Time through New Endpoint

为了扩展访问令牌,您需要使用短期访问令牌发出以下请求:

In order to extend the access token you need to make the following request with your short lived access token:

https://graph.facebook.com/oauth/access_token?             
    client_id=APP_ID&
    client_secret=APP_SECRET&
    grant_type=fb_exchange_token&
    fb_exchange_token=EXISTING_ACCESS_TOKEN 

这篇关于从 Facebook 获取长期访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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