Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: mount failed: invalid oauth code #1568

Closed
kaiyungtan opened this issue Sep 7, 2020 · 22 comments
Closed

ValueError: mount failed: invalid oauth code #1568

kaiyungtan opened this issue Sep 7, 2020 · 22 comments

Comments

@kaiyungtan
Copy link

Hi, i am trying drive mount on google colab and this happened as showned below: I have used google colab before with no problem. Please assist.

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

Enter your authorization code:
··········

ValueError Traceback (most recent call last)
in ()
1 from google.colab import drive
----> 2 drive.mount('/content/drive')

/usr/local/lib/python3.6/dist-packages/google/colab/drive.py in mount(mountpoint, force_remount, timeout_ms, use_metadata_server)
247 wrote_to_fifo = True
248 elif case == 5:
--> 249 raise ValueError('mount failed: invalid oauth code')
250 if not wrote_to_fifo:
251 with open(fifo, 'w') as fifo_file:

ValueError: mount failed: invalid oauth code

@codygunton
Copy link

I am experiencing the same issue.

@craigcitro
Copy link
Contributor

The copy button is broken on the oauth page; manually select and copy the code and you'll be good to go.

Duplicate of #1540.

@kaiyungtan
Copy link
Author

thanks. it works. indeed the copy button is broken. Thanks Craig.

@jerronl
Copy link

jerronl commented Jan 21, 2022

I got the same problem today. It didn't bring up the link to the auth page but failed with the same error msg.

@jonathanraditya
Copy link

Same here, 12hrs ago works just fine, and now failed with "ValueError: mount failed: invalid oauth code" error message.

@vicchen-qf
Copy link

Same here too! Can only mount the google drive account the colab notebook itself with "drive.mount('/content/drive')"

@kdassharma
Copy link

kdassharma commented Jan 21, 2022

Using:

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

gives me (after singing in using the popup):

/usr/local/lib/python3.7/dist-packages/google/colab/_message.py in read_reply_from_input(message_id, timeout_sec)
    104         reply.get('colab_msg_id') == message_id):
    105       if 'error' in reply:
--> 106         raise MessageError(reply['error'])
    107       return reply.get('data', None)
    108 

MessageError: Error: credential propagation was unsuccessful

and using:

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

gives me:

/usr/local/lib/python3.7/dist-packages/google/colab/drive.py in _mount(mountpoint, force_remount, timeout_ms, use_metadata_server, ephemeral)
    294       wrote_to_fifo = True
    295     elif case == 5 and not use_metadata_server:
--> 296       raise ValueError('mount failed: invalid oauth code')
    297     elif case == 6:
    298       # Terminate the DriveFS binary before killing bash.

ValueError: mount failed: invalid oauth code

@researchk
Copy link

Hi i am facing this issue since morning. Yesterday it was working perfectly fine. Anybody got the solution?

@researchk
Copy link

Using:

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

gives me (after singing in using the popup):

/usr/local/lib/python3.7/dist-packages/google/colab/_message.py in read_reply_from_input(message_id, timeout_sec)
    104         reply.get('colab_msg_id') == message_id):
    105       if 'error' in reply:
--> 106         raise MessageError(reply['error'])
    107       return reply.get('data', None)
    108 

MessageError: Error: credential propagation was unsuccessful

and using:

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

gives me:

/usr/local/lib/python3.7/dist-packages/google/colab/drive.py in _mount(mountpoint, force_remount, timeout_ms, use_metadata_server, ephemeral)
    294       wrote_to_fifo = True
    295     elif case == 5 and not use_metadata_server:
--> 296       raise ValueError('mount failed: invalid oauth code')
    297     elif case == 6:
    298       # Terminate the DriveFS binary before killing bash.

ValueError: mount failed: invalid oauth code

Have you found any solution?

@kdassharma
Copy link

Using:

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

gives me (after singing in using the popup):

/usr/local/lib/python3.7/dist-packages/google/colab/_message.py in read_reply_from_input(message_id, timeout_sec)
    104         reply.get('colab_msg_id') == message_id):
    105       if 'error' in reply:
--> 106         raise MessageError(reply['error'])
    107       return reply.get('data', None)
    108 

MessageError: Error: credential propagation was unsuccessful

and using:

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

gives me:

/usr/local/lib/python3.7/dist-packages/google/colab/drive.py in _mount(mountpoint, force_remount, timeout_ms, use_metadata_server, ephemeral)
    294       wrote_to_fifo = True
    295     elif case == 5 and not use_metadata_server:
--> 296       raise ValueError('mount failed: invalid oauth code')
    297     elif case == 6:
    298       # Terminate the DriveFS binary before killing bash.

ValueError: mount failed: invalid oauth code

Have you found any solution?

A temporary solution is to mount the drive with the button on the "Files" menu option, this worked for me.

@researchk
Copy link

but I want to mount from my other google account that's why it's not working for me.

@DinalieLiyanage
Copy link

Facing the same issue and I want to mount from another drive as well

@DinalieLiyanage
Copy link

DinalieLiyanage commented Jan 21, 2022

#2399 (comment)

@zechenli03 has mentioned a solution there, which is the old method. But yet it works

@researchk you can use this

@abhilashmandal
Copy link

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

This code started working again

@researchk
Copy link

@DinalieLiyanage not working for me.

@mustafahasankhan
Copy link

image
Use this button

image

then mount

@wizmain
Copy link

wizmain commented Jan 21, 2022

image Use this button

image

then mount

thanks it works

@jlmarrugom
Copy link

#2399 (comment)

@zechenli03 has mentioned a solution there, which is the old method. But yet it works

@researchk you can use this

This works for me, thanks

@cperry-goog
Copy link

dupe with #2563

@Vision238
Copy link

Hi, i am trying drive mount on google colab and this happened as showned below: I have used google colab before with no problem. Please assist.

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

Enter your authorization code:

··········
ValueError Traceback (most recent call last) in () 1 from google.colab import drive ----> 2 drive.mount('/content/drive')

/usr/local/lib/python3.6/dist-packages/google/colab/drive.py in mount(mountpoint, force_remount, timeout_ms, use_metadata_server) 247 wrote_to_fifo = True 248 elif case == 5: --> 249 raise ValueError('mount failed: invalid oauth code') 250 if not wrote_to_fifo: 251 with open(fifo, 'w') as fifo_file:

ValueError: mount failed: invalid oauth code

It happens only when you don't give all the permissions to google colab when it asks for the permission to access your google drive after running this command

@noha-El-Haddad
Copy link

We have the same problem ! it did work 2 days ago , is the problem global!

@gauravgund
Copy link

The following code worked for me:

!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
%cd /content
!mkdir drive
%cd drive
!mkdir MyDrive
%cd ..
%cd ..
!google-drive-ocamlfuse /content/drive/MyDrive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests