【发布时间】:2013-12-18 15:01:24
【问题描述】:
使用Google Plus SDK 登录。一开始一切都很好,但似乎 oauth 令牌在大约 1 小时后过期。我正在关注recommendations on Google's site 并使用
[signIn trySilentAuthentication]
在 viewDidAppear 函数中。
我知道令牌已过期,因为我在服务器上使用 Oauth 并收到 401 响应。
另外值得注意的是,如果 iPhone/iPad 一直插在屏幕上,这不是问题。在这种情况下,应用程序可以无限期地运行而不会出现任何问题。
我的 Cloud Endpoint 上的身份验证失败。我正在初始化服务如下:
static GTLService *service = nil;
if (!service) {
service = [[GTLServiceMyModel alloc] init];
service.retryEnabled = YES;
[service setAuthorizer: [GPPSignIn sharedInstance].authentication];
}
此外,如果应用程序的令牌已过期,我现在的解决方法是使用 iOS 应用程序切换器关闭应用程序并再次启动应用程序。然后,该应用程序将在令牌过期之前再次运行大约一个小时。
有人遇到过这个问题吗?任何帮助将不胜感激!
【问题讨论】:
标签: ios oauth google-plus google-oauth google-cloud-endpoints