Connect to Google Drive with API

Hello,

I hope I'm in the right place to ask my question!
I don't speak English and I'd like to try connecting to a Google Drive account.

I see some documentation I don't understand.
Is there a French version (and perhaps a more up-to-date one?) of the page: Google drive

I posted here:

welcome to the forum,

configuration initiale du lecteur


https://rclone-org.translate.goog/drive/?_x_tr_sl=auto&_x_tr_tl=fr&_x_tr_hl=en-US&_x_tr_pto=wapp#making-your-own-client-id

Thank you @asdffdsa. I launched it without really knowing what I was doing, but I don't see any API created on the page: https://console.cloud.google.com/apis/api/drive.googleapis.com

Here's what I have:

:~$ rclone config

Current remotes:

Name                 Type
====                 ====
IsaricGdrive         drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> d
Select remote.
Choose a number from below, or type in an existing value.
 1 > IsaricGdrive
remote> 1
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
Enter name for new remote.
name> IsaricGdrive
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
   \ (s3)
 6 / Backblaze B2
   \ (b2)
 7 / Better checksums for other remotes
   \ (hasher)
 8 / Box
   \ (box)
 9 / Cache a remote
   \ (cache)
10 / Citrix Sharefile
   \ (sharefile)
11 / Combine several remotes into one
   \ (combine)
12 / Compress a remote
   \ (compress)
13 / Dropbox
   \ (dropbox)
14 / Encrypt/Decrypt a remote
   \ (crypt)
15 / Enterprise File Fabric
   \ (filefabric)
16 / FTP
   \ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
18 / Google Drive
   \ (drive)
19 / Google Photos
   \ (google photos)
20 / HTTP
   \ (http)
21 / Hadoop distributed file system
   \ (hdfs)
22 / HiDrive
   \ (hidrive)
23 / In memory object storage system.
   \ (memory)
24 / Internet Archive
   \ (internetarchive)
25 / Jottacloud
   \ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
27 / Local Disk
   \ (local)
28 / Mail.ru Cloud
   \ (mailru)
29 / Microsoft Azure Blob Storage
   \ (azureblob)
30 / Microsoft OneDrive
   \ (onedrive)
31 / OpenDrive
   \ (opendrive)
32 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ (swift)
33 / Pcloud
   \ (pcloud)
34 / Put.io
   \ (putio)
35 / SMB / CIFS
   \ (smb)
36 / SSH/SFTP
   \ (sftp)
37 / Sia Decentralized Cloud
   \ (sia)
38 / Sugarsync
   \ (sugarsync)
39 / Transparently chunk/split large files
   \ (chunker)
40 / Union merges the contents of several upstream fs
   \ (union)
41 / Uptobox
   \ (uptobox)
42 / WebDAV
   \ (webdav)
43 / Yandex Disk
   \ (yandex)
44 / Zoho
   \ (zoho)
45 / premiumize.me
   \ (premiumizeme)
46 / seafile
   \ (seafile)
Storage> 18
Option client_id.
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a value. Press Enter to leave empty.
client_id> 
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> 
Option scope.
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
 1 / Full access all files, excluding Application Data Folder.
   \ (drive)
 2 / Read-only access to file metadata and file contents.
   \ (drive.readonly)
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ (drive.file)
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ (drive.appfolder)
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ (drive.metadata.readonly)
scope> 1
Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file> 
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine

y) Yes (default)
n) No
y/n> y
2025/06/02 17:38:34 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=j …         …  g
2025/06/02 17:38:34 NOTICE: Log in and authorize rclone for access
2025/06/02 17:38:34 NOTICE: Waiting for code...
2025/06/02 17:38:50 NOTICE: Got code
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n> n
Configuration complete.
Options:
- type: drive
- scope: drive
- token: {"access_token":"y… … 5","token_type":"Bearer","refresh_token":"1//0….g","expiry":"2025-06-02T18:38:49.325662747+02:00"}
- team_drive: 
Keep this "IsaricGdrive" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
IsaricGdrive         drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
:~$
:~$ rclone listremotes
IsaricGdrive:
:~$ rclone about IsaricGdrive:
Total:   15 GiB
Used:    545.677 MiB
Free:    14.467 GiB
Trashed: 0 B
Other:   539.103 KiB
:~$

So I encounter another problem:

:~$ rclone sync --update --progress IsaricGdrive:/Test /home/isaric/IsaricGdrive/Test
Transferred:              0 B / 0 B, -, 0 B/s, ETA -
Checks:                12 / 12, 100%
Elapsed time:         1.0s
:~$ 

Also without API with the above installation I cannot open a .odt file

:~$ rclone mount IsaricGdrive:/Test /home/isaric/IsaricGdrive/Test
2025/06/03 09:39:32 ERROR : Test310525 1707.odt: WriteFileHandle: ReadAt: Can't read and write to file without --vfs-cache-mode >= minimal

I am told: "Read error, cannot read data"

I'm still going on here: https://forum.ubuntu-fr.org/viewtopic.php?id=2091325

i do not see a problem.
add -vv for debug output


add --vfs-cache-mode=writes or --vfs-cache-mode=full

Thanks @asdffdsa

I continued there too
Specific path for access on Drive
and used

:~$ rclone mount Test: /home/isaric/IsaricGdrive/Test  --vfs-cache-mode writes

It seems to work :slightly_smiling_face:

I need to figure out how to create an API :thinking:

I think it's good now for API, I noted my procedure in French there:

https://forum.ubuntu-fr.org/viewtopic.php?pid=22841859#p22841859

I see appearing

:~$ rclone mount Test: /home/isaric/IsaricGdrive/Test  --vfs-cache-mode writes
2025/06/04 18:22:04 ERROR : .~lock.Test_001 1821.odt#: Failed to copy: context canceled
2025/06/04 18:33:01 ERROR : .~lock.Test_001 1821.odt#: Failed to copy: couldn't list directory: context canceled
^C2025/06/04 18:34:00 ERROR : /home/isaric/IsaricGdrive/Test: Failed to unmount: exit status 1: fusermount3: failed to unmount /home/isaric/IsaricGdrive/Test: Device or resource busy
:~$ 

What does that mean?