记住IOS设备上的App-Engine登录

时间:2014-03-08 03:40:13

标签: ios google-app-engine oauth-2.0

我一直在关注this Google page,它描述了如何在IOS下对App-Engine(云端点)后端进行身份验证。没关系。但是,似乎需要在每次运行程序时重新签名。

有没有办法

  1. 跳过登录/身份验证网络视图,转而使用某些全局资源
  2. 记住以前的登录/身份验证信息并重新使用,或
  3. 通过记住以前的用户名
  4. 来简化登录/验证过程

    如果IOS版本的行为与Android版本一样好,当然不需要登录步骤,因为它直接由操作系统处理。

    谢谢!

1 个答案:

答案 0 :(得分:0)

我现在已经解决了这个问题。我不知道在第一次通过时我是如何在文档中错过的。

请参阅https://code.google.com/p/gtm-oauth2/wiki/Introduction

上的“从钥匙串中检索授权”
GTMOAuth2Authentication* auth =
    [GTMOAuth2ViewControllerTouch
        authForGoogleFromKeychainForName:AUTH_KEYCHAIN_NAME
                                clientID:IOS_CLIENT_ID
                            clientSecret:IOS_CLIENT_SECRET];
if ([auth canAuthorize]) {
    // add existing auth to our GTLServiceFoo, cleverly named "fooEndpoint"
    [fooEndpoint setAuthorizer:auth];
} else {
    // go through sign-in dialog flow and add the auth resulting from that
    ...
}