Google Drive "Failed to configure token: failed to get token: oauth2: cannot fetch token: 401 Unauthorized Response"

What is the problem you are having with rclone?

Trying to setup my first config with Google Drive, following the steps posted.

I get the following error message:

Failed to configure token: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {
  "error": "invalid_client",
  "error_description": "Unauthorized"
}

What is your rclone version (output from rclone version)

rclone v1.55.1
- os/type: windows
- os/arch: amd64
- go/version: go1.16.3
- go/linking: dynamic
- go/tags: cmount

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Win10, x64

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone config

The rclone config contents with secrets removed.

I think the problem is that I'm unable to make one:

NOTICE: Config file "C:\\Users\\Dave\\.config\\rclone\\rclone.conf" not found - using defaults
Configuration file doesn't exist, but rclone will use this path:
C:\Users\Dave\.config\rclone\rclone.conf

EDIT: Yep, no config file:

Directory of C:\Users\Dave\.config\rclone

07/15/2021  07:18 PM    <DIR>          .
07/15/2021  07:18 PM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  749,997,719,552 bytes free

A log from the command with the -vv flag

I tried - I really tried. No matter what I put here I get "Sorry, you can't include links in your posts."

If somebody can explain how to post the log without that error, I'll post it as a reply.

Trying again:

(base) C:\Users\Dave\Desktop\Backups\rclone\rclone-v1.55.1-windows-amd64>rclone config
2021/07/15 19:35:01 NOTICE: Config file "C:\\Users\\Dave\\.config\\rclone\\rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> GDRIVE
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
   \ "fichier"
 2 / Alias for an existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Compress a remote
   \ "compress"
10 / Dropbox
   \ "dropbox"
11 / Encrypt/Decrypt a remote
   \ "crypt"
12 / Enterprise File Fabric
   \ "filefabric"
13 / FTP Connection
   \ "ftp"
14 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
15 / Google Drive
   \ "drive"
16 / Google Photos
   \ "google photos"
17 / Hadoop distributed file system
   \ "hdfs"
18 / Hubic
   \ "hubic"
19 / In memory object storage system.
   \ "memory"
20 / Jottacloud
   \ "jottacloud"
21 / Koofr
   \ "koofr"
22 / Local Disk
   \ "local"
23 / Mail.ru Cloud
   \ "mailru"
24 / Mega
   \ "mega"
25 / Microsoft Azure Blob Storage
   \ "azureblob"
26 / Microsoft OneDrive
   \ "onedrive"
27 / OpenDrive
   \ "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
29 / Pcloud
   \ "pcloud"
30 / Put.io
   \ "putio"
31 / QingCloud Object Storage
   \ "qingstor"
32 / SSH/SFTP Connection
   \ "sftp"
33 / Sugarsync
   \ "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
   \ "tardigrade"
35 / Transparently chunk/split large files
   \ "chunker"
36 / Union merges the contents of several upstream fs
   \ "union"
37 / Webdav
   \ "webdav"
38 / Yandex Disk
   \ "yandex"
39 / Zoho
   \ "zoho"
40 / http Connection
   \ "http"
41 / premiumize.me
   \ "premiumizeme"
42 / seafile
   \ "seafile"
Storage> 15
** See help for drive backend at: [redacted: "Sorry, you can't include links in your posts."] **

Google Application Client Id
Setting your own is recommended.
See [redacted: "Sorry, you can't include links in your posts."] for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id> [redacted]
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 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
ID of the root folder
Leave blank normally.

Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.

Enter a string value. Press Enter for the default ("").
root_folder_id>
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 string value. Press Enter for the default ("").
service_account_file>
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n>
Remote config
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> Yes
y/n>
If your browser doesn't open automatically go to the following link: [redacted: "Sorry, you can't include links in your posts."]
Log in and authorize rclone for access
Waiting for code...
Got code
2021/07/15 19:43:10 Failed to configure token: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {
  "error": "invalid_client",
  "error_description": "Unauthorized"
}

(base) C:\Users\Dave\Desktop\Backups\rclone\rclone-v1.55.1-windows-amd64>

I don't know why the forum software didn't complain this time - I'm just happy it didn't.

hello and welcome to the forum,

so you created your own client id by following this guide?
https://rclone.org/drive/#making-your-own-client-id

from the web browser did you see something like this

image

Yes, I did. Note that I got:

Waiting for code...
Got code

just now, i created a new client id/secret and tested it, no problems.

yes, i see that you got the Got code

I'm supposed to paste in the secret?

It says "Leave blank normally", so I did.

I'll try again that way. Thanks.

(Yes, I got the "Success!" reply in the web browser.)

you need to paste the id and secret when requested to....

Storage> drive
** See help for drive backend at: https://rclone.org/drive/ **

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 string value. Press Enter for the default ("").
client_id> ddfdfdfddd0813-8v2pb7jfp8968r5h861bbd8m9bje09lo.apps.googleusercontent.com
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> sssssrinIOhnHOsM6TvO1o60

That worked - thank you!!

sure, the first time this can be confusing, but you got it working...

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.