astrada / google-drive-ocamlfuse

FUSE filesystem over Google Drive
https://astrada.github.io/google-drive-ocamlfuse/
MIT License
5.57k stars 353 forks source link

Google drive grants only 7 days access #887

Open ccaneke opened 2 months ago

ccaneke commented 2 months ago

I created a new client id and secret for a google drive desktop client application but I was only able to give access to external users (@gmail.com) because I created the client app using a gmail account and only users in a google workspace (@custom-domain) can be an internal user. I then had to give access to a test user because I didn't want the client app to be held in a long verification process if I publish it.

The problem is that as an external user I had my google drive access limited to 7 days. I want unlimited access that is only removed if google-drive-ocamlfuse unmounts google drive.

My system is fedora linux and I installed ocaml using the fedora package manager as described in: https://github.com/astrada/google-drive-ocamlfuse/wiki/Installation#installing-with-opam-on-nobara-linux.

astrada commented 2 months ago

Yes, Google limits the refresh token for test applications to 7 days, but you can move it to production to remove that limitation (see #882).

ccaneke commented 2 months ago

Yes, Google limits the refresh token for test applications to 7 days, but you can move it to production to remove that limitation (see #882).

Thanks a lot. I changed the app to production. How do I force google-drive-ocaml-fuse to forget its state so that I can reauthorize and get a new access token. I've tried clearing the cache with google-drive-ocaml-fuse but that doesn't clear the state and so it still remembers the old client id and secret. I've also tried re-running google-drive-ocaml-fuse with the -id and -secret flags but the state is unchanged.

ccaneke commented 2 months ago

@astrada which step of the installation https://github.com/astrada/google-drive-ocamlfuse/wiki/Installation#installing-with-opam-on-nobara-linux creates the directory .gdfuse, is it 3 or 2?

astrada commented 2 months ago

That directory is created the first time you run the application.

ccaneke commented 2 months ago

That directory is created the first time you run the application.

Thanks. Then to forget the credentials, I just have to delete .gdfuse and then run google-drive-ocamlfuse` with the -id and -secret flags.

Medullitus commented 2 months ago

Thank you but isn't there easier way just like rclone provides?

ccaneke commented 1 month ago

@astrada

$ google-drive-ocamlfuse ~/GoogleDrive
$ ls -a GoogleDrive/
ls: cannot access 'GoogleDrive/': Input/output error
$ sudo ls -a GoogleDrive/
ls: cannot access 'GoogleDrive/': Permission denied
$ cat .gdfuse/default/state | head -n 2
access_token_date=2024-09-09T03:24:47.000Z
auth_request_date=2024-09-09T03:24:47.000Z

Is this because the access token has expired? google-drive-ocamlfuse doesn't show any error or warning.

astrada commented 1 month ago

Yes, I think so. Unfortunately the error reporting must go through the FUSE interface that is not suited to report friendly errors. If you want to be sure, you should enable debug logs and check the real error there.

ccaneke commented 1 month ago

@astrada I deleted .gdfuse.

and then authorized google-drive-ocamlfuse to access the Google Drive account:

google-drive-ocamlfuse -id xxxxxxxxxx.apps.googleusercontent.com -secret XXX-YYY-ZZZ

which caused this warning:

GoogleDriveWarning

But after completing the OAuth authorisation process I still got the Input/Output error:

$ ls -a GoogleDrive
ls: cannot access 'GoogleDrive': Input/output error

so I ran:

fusermount -u ~/GoogleDrive
rm -rI GoogleDrive

then:

mkdir ~/GoogleDrive

, and finally

google-drive-ocamlfuse ~/GoogleDrive

succeeded.

I'm not sure whether removing the GoogleDrive directory or fusermount -u ~/GoogleDrive fixed the ls: cannot access 'GoogleDrive': Input/output error error.

I know that the Google hasn't verified this app warning can be avoided by submitting a verification request to Google like the warning says. Do you have any idea how long this verification request takes and what it requires? I don't plan on publishing this Desktop app so no one else but me will use it, however I'm curious about the verification process and what others think of it.

astrada commented 1 month ago

It looks like you can push your app to production without Google verification: https://github.com/rclone/rclone/issues/7963#issuecomment-2241051010