tyterry
tyterry

Reputation: 1

Google Colab - Authorization error to google drive

I am trying to link my colab to the google drive by this code:

from google.colab import drive
drive.mount('/content/drive')

It has always worked until today, clicking on the oauth2 link only brings me the following screen

Error 403: access_denied screen

I have tried logging out all the google accounts, using incognito mode, etc. but none of them works

I would appreciate any help.

Many thanks!

Upvotes: 0

Views: 880

Answers (2)

Maxwell Redacted
Maxwell Redacted

Reputation: 589

Update 17/11/2021

They have since rolled back so the 'old' method is the default - therefore the fault behind the error I addressed should no longer occur.

However, this solution may still be useful if the fault reemerges, otherwise refer to @AEM's answer for the alternative ways to mount your drive.

Original Answer

There is an open Github issue since it seems to have resurfaced - albeit it seems to be as a result of a different cause: https://github.com/googlecolab/colabtools/issues/2422

there seems to be a bug in the way the new mount method works,

as per the GitHub thread, you can use the following to use the old method of sign-in, using '_mount' as shown below:

from google.colab import drive

drive._mount('/drive')

Upvotes: 1

AEM
AEM

Reputation: 1386

There are many ways to mount or link Google drive in Colab:

  1. Connect using Colab itself by click on this icon: enter image description here

  2. Connect using these commands :

from google.colab import drive
drive.mount('/content/drive')

Conclusion

enter image description here

Copy the auth code instead of clicking the copy button will solve your issue. It seems java-script compatibility issue within the code of the copy button. Press Ctrl+A and then Ctrl+C to copy auth code. After that go back to colab and paste it using Ctrl+V here:  Image

Upvotes: 1

Related Questions