一段时间以来,我无法从我的 Google 帐户在 Google Apps 脚本中为我正在使用的文件之外的范围提供任何新的 OAuth 授权(.currentonly有效,其他一切都无效)。
它要求提供我想要使用的 Google 帐户,并在选择它显示的帐户后:
此应用已被阻止
此应用试图访问您 Google 帐户中的敏感信息。为确保您的帐户安全,Google 阻止了此访问。
看截图:

甚至没有显示具有请求权限概述的屏幕。对于我尝试添加权限的每个新的或旧的电子表格文件,都会发生这种情况。但是在停止工作之前已经获得 OA 的电子表格会定期更新项目触发器。
这是我的清单文件:
{
"timeZone": "Europe/Paris",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
"https://www.googleapis.com/auth/spreadsheets.currentonly", // this works
"https://www.googleapis.com/auth/drive", // this doesn't work
"https://www.googleapis.com/auth/spreadsheets" // this also doesn't work
],
"runtimeVersion": "V8"
}
Run Code Online (Sandbox Code Playgroud)
当我尝试从不同的 Google 帐户执行相同操作时,一切正常。因此,我认为这与整个 Google 帐户设置有关。
我尝试启用,Less secure app access但没有帮助。
是否有可能在该帐户中禁用了来自未经验证的 3rd 方应用程序的访问?我怎样才能再次启用它?
我已经通过brew install gdrive安装了Mac的gdrive库。
我的目标是以编程方式将文件从本地计算机上传到 Google Drive。
但是,当我执行 gdrive 上传时,它显示:
“此应用暂时禁用使用 Google 登录
此应用尚未经过 Google 验证,无法使用 Google 登录。”
我也一直在研究 Google Drive API v3。https://developers.google.com/drive/api/v3/reference/files/create#try-it
但是,我找不到在哪里获取文档中提到的 api 密钥和访问令牌。所有对 Google Drive API 的搜索都会转到 Google Cloud。
如何绕过这些限制来上传到 Google 云端硬盘?
从谷歌登录时出现此错误
“此应用试图访问您的 Google 帐户中的敏感信息。为了确保您的帐户安全,Google 阻止了此访问
”
我的代码在下面提到,我打电话给谷歌登录
#pragma mark - Google Drive Login
-(void)googlePlusLogin{
GIDSignIn *signin = [GIDSignIn sharedInstance];
signin.shouldFetchBasicProfile = true;
signin.delegate = self;
signin.presentingViewController = self.window.rootViewController;
//signin.uiDelegate = self;
NSString *driveWrite = @"https://www.googleapis.com/auth/drive";
NSArray *currentScopes = [GIDSignIn sharedInstance].scopes;
// [GIDSignIn sharedInstance].scopes = [currentScopes arrayByAddingObject:driveScope];
[GIDSignIn sharedInstance].scopes = [currentScopes arrayByAddingObject:driveWrite];
[self performSelector:@selector(checkForLoginInGoogle) withObject:nil afterDelay:0.1];
}
-(void)checkForLoginInGoogle{
GIDSignIn *signin = [GIDSignIn sharedInstance];
if ([signin hasPreviousSignIn]) {
[signin restorePreviousSignIn];
}
else{
[signin signIn];
}
}
Run Code Online (Sandbox Code Playgroud)