如何处理“应用暂时无法使用您的 Google 帐户登录”障碍

How to handle “App is temporarily blocked from logging in with your Google account” barrier

我正在使用 gdrive and gshell 来与我的 Google 帐户互动并下载文件,获取他们的信息。

当我 运行: gdrive aboutgdown about 时,我收到以下消息

Initializing system (/home/user/.gdrive)
Authentication needed
Go to the following url in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=...... \
apps.googleusercontent.com&redirect_uri=....

Enter verification code:

之后,当我在浏览器上粘贴以 https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id= 开头的 URL 时,我不断收到以下错误消息:

This app is temporarily blocked from logging in with your Google account.

==> 这个错误之前没有发生,我能够收到 verification code,以便用于连接到我的帐户。

是否有可能克服 Google 的障碍,以便使用 gdrivegdown


生成的例子token.json,验证码粘贴后

  "access_token": ".....",
  "token_type": "Bearer",
  "refresh_token": "1/....",
  "expiry": "2020-12-21T02:..."
}

@tellowkrinkle 的 comment 帮我解决了这个问题。

Probably yes. I have the old binary and Google blocks it from authenticating, saying that it's dangerous and they blocked it for my safety (thanks a lot). It looks like Google now requires you to let them review applications that want to access sensitive information through their API

If you want to use it for yourself, you will need to:

  1. Go to https://console.developers.google.com and create a new project for yourself
  2. Search for the Google Drive API in the search box at the top, and enable it
  3. Click OAuth consent screen on the left and set it up.
    • Assuming your account isn't part of an organization, you'll have to say your app is for external users and in testing
    • In the required scopes section, add .../auth/docs and .../auth/drive (I'm not sure which needed, it's probably only one of those). This will probably not be available if you didn't complete (2)
    • Add the accounts you want to use with your copy of gdrive as testers of your app. Only these accounts will be able to use your copy of gdrive, so everyone will have to compile their own (unless someone goes and gets theirs reviewed by Google)
  4. Click Credentials on the left, then Create Credentials, then OAuth client ID. The application type is Desktop app
  5. Copy the Client ID and Secret into handlers_drive.go lines 17 and 18 and compile the application

$ git clone https://github.com/prasmussen/gdrive.git
$ cd gdrive
$ nano handlers_drive.go
# Copy the Client ID and Secret into handlers_drive.go lines 17 and 18 and compile the application
$ mv ~/.gdrive/token_v2.json ~/.gdrive/token_v2.json.old
$ go get github.com/prasmussen/gdrive
$ go build -ldflags "-w -s"
$ cp gdrive $GOPATH/bin/gdrive
$ gdrive about 
Go to the following url in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=.....

Enter verification code:

指南: