dvc: Unable connect dvc to Google Drive. Access blocked!
Added by @shcheklein :
See details and workaround here - https://github.com/iterative/dvc/issues/10516#issuecomment-2289652067
Failed to authenticate GDrive: “This app is blocked”
Description
When I use DVC commands with a gdrive remote storage configuration, I encounter an issue where it’s impossible to authenticate with my Google account.
Reproduce
After initiating the command
dvc get https://github.com/my-data-registry data/samples
a browser window opens for authentication, but upon selecting my Google account, I’m directed to a page displaying the message:
This app is blocked
This app tried to access sensitive info in your Google Account. To keep your account safe, Google blocked this access.
Environment information
Output of dvc doctor:
$ dvc doctor
Platform: Python 3.11.6 on macOS-13.5-arm64-arm-64bit
Subprojects:
dvc_data = 3.15.2
dvc_objects = 5.1.0
dvc_render = 1.0.2
dvc_task = 0.4.0
scmrepo = 3.3.7
Supports:
gdrive (pydrive2 = 1.20.0),
http (aiohttp = 3.10.2, aiohttp-retry = 2.8.3),
https (aiohttp = 3.10.2, aiohttp-retry = 2.8.3)
Config:
Global: /Users/myself/Library/Application Support/dvc
System: /Library/Application Support/dvc
I’m not sure if this is a bug, but any help with this issue would be greatly appreciated!
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 10
- Comments: 23 (3 by maintainers)
Commits related to this issue
- .dvc is broken. See https://github.com/iterative/dvc/issues/10516#issuecomment-2289652067 — committed to shaliulab/idoc-paper by antortjim 2 years ago
TL;DR:
The DVC app (that is used by default by DVC) is blocked by Google because they changed some policies and we need pass the verifications again. There was nothing bad happening (like security breaches or violations) on our end. There is not easy way to pass it. For now the recommended way (and it was always the recommended way) - is to create a custom app. Here is the link. It’s not very complicated and should work just fine for everyone.
Longer version
Tue, Nov 14, 2023 - Google reached out with this message:
DVC app indeed depends on the
drive.filesOAuth scope (that gives the full access to all the files / directories in the Google Drive). Since we don’t know in advance which directory users would need to use a remote storage + for things likedvc import-url,dvc import(if a different remote is used).Anyways, it would be better to have a more granular permissions. And it seems Google understand this, we also like it. The only issue is that there is no API or any way to let users
picka specific dir in CLI. Here is the relevant ticket for this. But it’s not resolved yet.So, we kinda stuck in limbo with this a bit - we can’t pass verification (since they are requesting a video explainer where it’s clear why we need
drive.file), and we can’t implement a granular scope management for the default app atm.I’m open to any ideas on this.
Also a relevant discussion on the
rcloneforum - https://forum.rclone.org/t/google-drive-builtin-app-verification/43919/5 .I have precisely the same issue.
You can authenticate in google at your own. First, you need to create oauth client id (like here). Then, download the client id json and use the following code:
Then, you need to move
generated_token.jsonin gdrive_user_credentials_file (look here).Profit!
Yes, it’s a clutch, but it’s the only way I found so far.
cp: @kell18
the custom app using the Google cloud option works, but would have preferred the older way of authenticating with gdrive, which was fairly easy
@tharhtetsan Find the answer here - https://github.com/iterative/dvc/issues/10516#issuecomment-2289652067
@SchindlerTo @ryukinix take a look here https://github.com/iterative/PyDrive2/issues/184#issuecomment-1200081628 . I think that was a relevant discussion.
I am considering migrating to git LFS due to this problem.
Even the Google cloud option didn’t work for me, it failed with
ERROR: unexpected error - Failed to authenticate GDrive: 'access_token'duringdvc push@shcheklein, thank you for the clarification! We will proceed with the custom app option.