gpt4 book ai didi

ios - 如何在 Google Drive iOS API 中注销?

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:23:55 26 4
gpt4 key购买 nike

我正在使用 Google 的 guide将 Drive 的功能集成到我自己的应用程序中,但我找不到允许我从应用程序中注销我的谷歌帐户的方法。

有什么我可以调用以注销,或者我应该保持登录状态直到我卸载应用程序吗?

最佳答案

经过更多尝试,我可能找到了解决方案:

在 viewDidLoad 中,Drive API 服务以这种方式初始化(​​取自上述指南):

// Initialize the Drive API service & load existing credentials from the keychain if available.
self.service = [[GTLServiceDrive alloc] init];
self.service.authorizer =
[GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:kKeychainItemName
clientID:kClientID
clientSecret:nil];

所以要注销,从钥匙串(keychain)中删除授权就足够了:

[GTMOAuth2ViewControllerTouch removeAuthFromKeychainForName:kKeychainItemName];

我刚刚试了一下,它似乎工作正常。调用之后,如果我尝试返回 View ,系统会再次提示我输入凭据。

关于ios - 如何在 Google Drive iOS API 中注销?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37300454/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com