Mounting OneDrive Personal at Windows 10: "Error: failed to get token"

What is the problem you are having with rclone?

I followed the instructions in the "Microsoft OneDrive" article including app registrations in Microsoft Azure. During authorization in the browser, I confirmed the issuance of the requested rights to the application:

2022/09/07 19:00:22 NOTICE: Make sure your Redirect URL is set to "http://localhost:53682/" in your custom config.
2022/09/07 19:00:22 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=tTqpbdKT_tv48F7R7cMFlg
2022/09/07 19:00:22 NOTICE: Log in and authorize rclone for access
2022/09/07 19:00:22 NOTICE: Waiting for code...
2022/09/07 19:00:36 NOTICE: Got code
Error: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {"error":"invalid_client","error_description":"AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app '6cfc01be-(...)'.\r\nTrace ID: fb4111e1-85d1-4df5-97c7-9f5552e9c801\r\nCorrelation ID: cec81483-6005-4688-9fab-e31bec064333\r\nTimestamp: 2022-09-07 16:00:35Z","error_codes":[7000215],"timestamp":"2022-09-07 16:00:35Z","trace_id":"fb4111e1-85d1-4df5-97c7-9f5552e9c801","correlation_id":"cec81483-6005-4688-9fab-e31bec064333","error_uri":"https://login.microsoftonline.com/error?code=7000215"}

Endless loading onedrive.live .com/unlock window:

onedrive.live.com — endless loading

I tried Mozilla Firefox 105.0b8 (64-bit) and Microsoft Edge 105.0.1343.27. In both cases, I get a disk ID not available error.

Microsoft Windows 10.0.19043.1949

Run the command 'rclone version' and share the full output of the command.

rclone v1.59.1

  • os/version: Microsoft Windows 10 Pro 21H1 (64 bit)
  • os/kernel: 10.0.19043.1949 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.18.5
  • go/linking: static
  • go/tags: cmount

Which cloud storage system are you using?

Microsoft OneDrive

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

.\rclone.exe mount OneDrive: M:

The rclone config contents with secrets removed.

[OneDrive]
type = onedrive
client_id = 6cfc01be-...
client_secret = QtWUh&t...
drive_type = personal
expose_onenote_files = true
server_side_across_configs = true
link_type = edit

A log from the command with the -vv flag

2022/09/07 23:06:37 DEBUG : rclone: Version "v1.59.1" starting with parameters ["D:\\Rclone\\rclone.exe" "mount" "OneDrive:" "M:" "-vv"]
2022/09/07 23:06:37 DEBUG : Creating backend with remote "OneDrive:"
2022/09/07 23:06:37 DEBUG : Using config file from "C:\\Users\\User\\.config\\rclone\\rclone.conf"
2022/09/07 23:06:37 Failed to create file system for "OneDrive:": unable to get drive_id and drive_type - if you are upgrading from older versions of rclone, please run `rclone config` and re-configure this backend

Related topics where I didn't find a solution to my problem

hello and welcome to the forum,

that is a very confusing message.

by way of an example, the client secret value is U4B********

and the remote would look something like

[onedrivevb]
type = onedrive
client_id = redacted
client_secret = U4B8Q~rW3jt_dIfWQQh4redacted
token = {"access_token":"","expiry":"2022-09-05T15:02:53.521013-04:00"}
drive_id = 
drive_type = business

You are right, I mixed up the "Client secret" ("client_secret", "OAuth Client Secret") and "Secret ID" variable. It was not obvious to me that these are different things. And I didn't compare them. I corrected the value in rclone.conf, ran the mount command, and got the same result as before. Then, I went through all the steps of editing the profile again, again confirmed the login in the browser ("Success! All done. Please go back to rclone"), and again

2022/09/08 01:02:02 Fatal error: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {"error":"invalid_client","error_description":"AADSTS7000215: Invalid client secret provided. Ensure the secret being sent in the request is the client secret value, not the client secret ID, for a secret added to app '6cfc01be-redacted'.\r\nTrace ID: b3fca9da-edce-4ea8-9549-044a1d5ebd01\r\nCorrelation ID: a8597a14-1be2-49fa-8688-80f90b8a259d\r\nTimestamp: 2022-09-07 22:02:01Z","error_codes":[7000215],"timestamp":"2022-09-07 22:02:01Z","trace_id":"b3fca9da-edce-4ea8-9549-044a1d5ebd01","correlation_id":"a8597a14-1be2-49fa-8688-80f90b8a259d","error_uri":"https://login.microsoftonline.com/error?code=7000215"}

The line token = { did not appear in rclone.conf.

that is the exact same error as before.

fwiw, i would create a new remote each time, not re-editing a bad one.
and not manually editing the rclone.conf

and hard to see what is going, with just snippets and no redacted config file.

I figured out what was my mistake:

[OneDrive]
type = onedrive
client_id := Application (client) ID
client_secret := Client secret's Value

It's just that there are so many mentions of the words "secret" and "ID" in the Microsoft Azure interface and in the help for working with rclone that it's no wonder to make a mistake somewhere. Thanks a lot for trying to help!

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