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.
nothing
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
[snipped]
13 / Google Drive
\ "drive"
[snipped]
Storage> 13
** 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> [snipped].apps.googleusercontent.com
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> [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 ("").
service_account_file>
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 127.0.0.1:53682: 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:
Success!
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.
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: http://127.0.0.1:53682/auth?state=_0N1mvu0fFuiiw6MzcMUsg
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:
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 http://127.0.0.1:53682/auth?state=[snipped] and it told me 127.0.0.1 refused to connect. That's weird, since it worked OK while running rclone config.
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.
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 (rclone.org) is. My distribution uses scripts to build packages from scratch. For rclone v 1.57 it runs this script: this
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).
Thanks.
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 !