Facebook是否有OAuth的刷新符号? [英] Do Facebook has a refresh token of OAuth?

查看:135
本文介绍了Facebook是否有OAuth的刷新符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道是否有刷新令牌,多久会过期? 60天?



如果Facebook没有刷新令牌,那么我可以理解长时间的实时访问令牌作为刷新令牌,并将简短的实时访问令牌作为访问令牌



谢谢。

解决方案

Facebook不提供刷新令牌



Facebook提供两种访问令牌,


  1. 短暂访问令牌
    在短时间内(约2小时)后过期的令牌。


    短期访问令牌通常用于Web客户端。



  2. 长期访问令牌:一个访问令牌,使用寿命长(约60天)。


    长寿命访问令牌通常用于移动应用和服务器端。



您可以生成长寿命访问令牌 w使用Android和iOs的Facebook SDK,当使用您的应用的用户向Facebook的服务器发出请求时,这些令牌将每天刷新一次。如果没有请求,令牌将在预设到期后到期,并且该人将不得不再次通过登录流程来获取新的令牌。



这是可能的为长期访问令牌交换有效的短期访问令牌



有关令牌的文档解释很好,交换方法,调用参数等。



如果Facebook没有刷新令牌,那么我可以理解长实时访问令牌作为刷新令牌,以及作为访问令牌的简短实时访问令牌?



否。你不能。刷新令牌是一个可用于获取新的访问令牌的令牌。



如果连接了,SDK SDK可以在令牌到期之前定期刷新访问令牌。 >

Do Facebook has a refresh token of OAuth?

I wanna know if there is a refresh token, how long will it be expired? 60days?

And if Facebook don't have refresh token, then can I understand the long live access token as the refresh token, and short live access token as the access token?

Thanks.

解决方案

Facebook does not provide a refresh token.

Facebook provides two kinds of access tokens,

  1. Short lived access token: A token that is expired after a short period of time (about 2 hours).

    Short lived access tokens are usually used on web clients.

  2. Long-lived access tokens: An access token which has a long life (about 60 days).

    Long lived access tokens are usually used on mobile apps and server side.

You can generate long lived access tokens with the Facebook SDKs for Android and iOs, These tokens will be refreshed once per day when the person using your app makes a request to Facebook's servers. If no requests are made, the token will expire after the preset expiry and the person will have to go through the login flow again to get a new token.

It is possible to exchange a valid short lived access token for a long lived access token.

The documentation explains well about the tokens, exchanging methods, call parameters etc..

And if Facebook don't have refresh token, then can I understand the long live access token as the refresh token, and short live access token as the access token?

No.You can't. Refresh token is a token that may be used to obtain a new access token.

Facebook SDKs can refresh an access token at regular intervals before token expiry if connected.

这篇关于Facebook是否有OAuth的刷新符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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