我在应用程序中使用 FBSDKLoginKit
来进行用户身份验证。
我需要保持用户登录状态,除非用户明确选择从应用程序注销。
为此,我需要刷新 FBSDKLoginKit
token ,而不向用户显示登录屏幕。
那么有人可以帮助我如何实现这一目标吗?
EDIT
我希望用户只登录一次,并让用户在另一天回来时直接使用该应用程序。由于 FBSDK token 将在 60 天后过期,因此需要一种在用户返回应用程序时自动刷新的方法
EDIT2
我发现了一个名为 refreshCurrentAccessToken
的方法,但仍不清楚如何使用它,因为不确定何时调用它。
最佳答案
根据 Facebook 文档。如果您向 Facebook 服务器发出请求,访问 token 将每天自动刷新。
Native mobile apps using Facebook's SDKs will get long-lived access tokens, good for about 60 days. 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 about 60 days and the person will have to go through the login flow again to get a new token.
关于ios - 如何从 iOS APP 刷新 FBSDK 访问 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38503315/