Search code examples
apiauthenticationverificationgdrive

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


I am using gdrive and gshell in order to interact with my Google account and download files, get their info.

When I run: gdrive about or gdown about, I get following message

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:

Afterwards, I keep getting following error message, when I pasted the URL starting with https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id= on my browser:

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

enter image description here

==> This error was not generated before and I was able to receive the verification code, in order to use to connect into my account.

Is it possible to overcome this barrier of Google in order to use gdrive or gdown?


The example of generated token.json, after the verification code is pasted.

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

Solution

  • @tellowkrinkle's comment help me to solve the issue.

    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:
    

    Guide: