ios - 如何从 iOS APP 刷新 FBSDK 访问 token

标签 ios swift facebook facebook-ios-sdk fbsdkloginkit

我在应用程序中使用 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/

相关文章:

ios - Tableviewcell 不显示图像 | swift

objective-c - objective-c 中使用 CBC 模式的 3DES 加密

ios - Xcode IME - 快速获取方法调用参数类型的快捷方式?

ios - 在 iOS 上使用 MDCBottomNavigationBar 切换 View Controller

facebook - 如何通过 Facebook 的 Javascript SDK 安全地授权用户

facebook - Facebook 评论页面中的 publish_actions 在哪里?

ios - iOS渲染到纹理:为什么清晰

ios - 应用收到推送通知时,ios播放继续发出声音

random - 如何在 Swift 中播种随机数生成器?

c++ - C++ 中的 Facebook 图形 API