我正在使用 Google-API-Client 和 gtm-oauth2 库。当登录成功完成时
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
finishedWithAuth:(GTMOAuth2Authentication *)authResult
error:(NSError *)error {
我在 authResult.authResult 中返回了一个访问 token
但是,如果我自动或使用
查看保存到钥匙串(keychain)中的内容[GTMOAuth2ViewControllerTouch saveParamsToKeychainForName:kGoogleKeychainItemName authentication:authResult];
我没有看到访问 token 在我检索后被保存。仅保存刷新 token
如果我立即或任何其他时间做
GTMOAuth2Authentication *auth =
[GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:kGoogleKeychainItemName
clientID:kGoogleClientID
clientSecret:kGoogleClientSecret error:&error];
我的访问 token 为零
我认为这是故意的,但我看不到任何相关文档。为什么会发生这种情况,背后的想法是什么。
最佳答案
数据未保存的原因有以下几种:
可能方法 (authForGoogleFromKeychainForName) 不受支持。
如果手机中存在指纹扫描仪,则可能在使用钥匙串(keychain)的设置中应该有其他功能 - 我们在存在指纹的手机上存在一些保存问题。
关于ios - 将 AccessToken 保存到 Google Drive API 的钥匙串(keychain),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31676896/