Config problems: Success but OAuth token error

What is the problem you are having with rclone?

I'm trying to config rclone so I can locally mount remote Google Drive directories shared with me. I go through the steps, I get the Success message after the web authentication, etc., but I get errors at the console and get no ~/.config/rclone/rclone.config file. Here are the errors:

Waiting for code...
Got code
2022/01/04 12:25:08 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)

- os/arch: linux/amd64
- go version: go1.15.5

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.


A log from the command with the -vv flag

2022/01/04 13:05:01 DEBUG : rclone: Version "v1.53.3-DEV" starting with parameters ["rclone" "-vv" "config"]
2022/01/04 13:05:01 NOTICE: Config file "[snipped].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> [snipped]_shared
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
13 / Google Drive
   \ "drive"
Storage> 13
** See help for drive backend at: **

Google Application Client Id
Setting your own is recommended.
See 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> [snipped]
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
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> [snipped]
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 ("").
Edit advanced config? (y/n)
y) Yes
n) No (default)
2022/01/04 13:09:25 DEBUG : Received GET request on auth server to "/"
Got code
2022/01/04 13:09:26 DEBUG : Closing auth server
2022/01/04 13:09:26 DEBUG : Closed auth server with error: accept tcp use of closed network connection
2022/01/04 13:09:26 Failed to configure token: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {
  "error": "invalid_client",
  "error_description": "Unauthorized"

In the web browser I get this message:


All done. Please go back to rclone.

And this is the contents of the config directory:

ll ~/.config/rclone/
total 4
drwxr-xr-x 78 xxx 1005 4096 Jan  4 11:43 ../
drwxr-xr-x  2 xxx  xxx    6 Jan  4 11:43 ./

I've searched for answers on this forum but nothing helps.

Step 1 - Update rclone as you have some odd old dev version.

Did you put in a client ID and client secret? That error means you have something pasted in wrong.

OK, I installed 1.57, although it's in the testing branch (I like to keep to stable).

rclone v1.57.0-DEV
- os/version: gentoo 2.7 (64 bit)
- os/kernel: 5.15.11-gentoo (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.5
- go/linking: dynamic
- go/tags: none

But I'm getting the same message in the browser:


All done. Please go back to rclone.

and the very similar error messages:

2022/01/04 14:10:30 NOTICE: Make sure your Redirect URL is set to "urn:ietf:wg:oauth:2.0:oob" in your custom config.
2022/01/04 14:10:30 NOTICE: If your browser doesn't open automatically go to the following link:
2022/01/04 14:10:30 NOTICE: Log in and authorize rclone for access
2022/01/04 14:10:30 NOTICE: Waiting for code...
2022/01/04 14:10:42 NOTICE: Got code
Error: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {
  "error": "invalid_client",
  "error_description": "Unauthorized"

and then the rclone usage messages (?), and then this:

2022/01/04 14:10:43 Fatal error: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {
  "error": "invalid_client",
  "error_description": "Unauthorized"

There were some other posts to the forums that mentioned opening http connections on the firewall. Do I need to do that? Would that mean I'd have to open port 53682? I just tried to access the web server on localhost with[snipped] and it told me refused to connect. That's weird, since it worked OK while running rclone config. :thinking:

I am not sure why you are installing a dev build again. Please just use the latest stable.

You didn't answer my question either:

I don't know what that DEV indicates. It's what my distro installs.
Yes, I used the Google API facility to generate a client ID. I didn't generate a client secret. I didn't paste anything incorrectly.

Installation should be done from:

Install (

Anything else gets you something we aren't sure what it is.

You need a client ID AND a client secret or you get the error you stated. They are a pair and have to go together. You can't have one without the other.

I don't know what install ( is. My distribution uses scripts to build packages from scratch. For rclone v 1.57 it runs this script:

It seemed to me while I was running rclone config that the default for client secret was not to use one.
Here's that section of the log from rclone config:

OAuth Client Secret
Leave blank normally.

When I generated my client ID I didn't get a client secret. Perhaps I screwed something up. I'll wipe it out and try afresh (tomorrow).

If you click the link I shared, and just hit the scripted install, that's it.

Install (

This shows you how to create a client ID and secret.

Google drive (

You neglected the link above it and you filled in one and not the other.

If you follow the documentation and what I'm sharing, you'd be solved :slight_smile:

I don't like to install software outside my distribution's package management system. It makes things waaaayyyy complicated.

I thought I followed those instructions on making-your-own-client-id. I guess I messed up somewhere. I'll have to try again.

With rclone, you'll have an unsupported version as it's maintained by a 3rd party and not rclone. Rclone's supported install is from the link I listed and you can update it. Using a package repo is not supported.

You didn't follow the instructions as step 10 says to paste in the client ID and secret:

10. Provide the noted client ID and client secret to rclone.

I'd strongly advise to not use a package repo but it's your computer / your choice and I can't force you to follow a supported path.

I don't know why I didn't get a client secret before, but I tried it again, got the client secret, put it in rclone config where required, and it all works.
Thank you very much for your patient help, @Animosity022 !

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