Onedrive "Unauthenticated" when trying to copy/sync, but can use 'lsd'

What is the problem you are having with rclone?

I can't upload my files to OneDrive - says I'm Unauthenticated.

I can use the rclone lsd odrive: command, and it's output is correct. When I try to upload, the directory structure is created on the remote, but no files are uploaded. I have more than enough free space.

I've also tried to remove and add the remote again, but no success. I've followed the guide here

Also ran the command without the filter flags, but no luck either. I don't know where to go next from here

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

rclone v1.63.1
- os/version: Microsoft Windows 10 Home 22H2 (64 bit)
- os/kernel: 10.0.19045.3324 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.20.6
- go/linking: static
- go/tags: cmount

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

Microsoft OneDrive, Personal

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

rclone sync C:\Users\Mark\Documents\Gnucash\ odrive:Mark/gnucash --filter "- *.log" --filter "- *.gnucash.*.gnucash" --filter "- *.csv" --filter "- *.xlsx" --filter "- *.zip"

The rclone config contents with secrets removed.

[odrive]
type = onedrive
token = {"access_token":"secret","token_type":"Bearer","refresh_token":"secret","expiry":"2023-08-21T21:01:23.5260245+02:00"}
drive_id = secret
drive_type = personal

A log from the command with the -vv flag

C:\Users\Mark>rclone sync C:\Users\Mark\Documents\Gnucash\ odrive:Mark\gnucash --filter "- *.log" --filter "- *.gnucash.*.gnucash" --filter "- *.csv" --filter "- *.xlsx" --filter "- *.zip" -vv
2023/08/21 20:13:58 DEBUG : rclone: Version "v1.63.1" starting with parameters ["rclone" "sync" "C:\\Users\\Mark\\Documents\\Gnucash\\" "odrive:Mark\\gnucash" "--filter" "- *.log" "--filter" "- *.gnucash.*.gnucash" "--filter" "- *.csv" "--filter" "- *.xlsx" "--filter" "- *.zip" "-vv"]
2023/08/21 20:13:58 DEBUG : Creating backend with remote "C:\\Users\\Mark\\Documents\\Gnucash\\"
2023/08/21 20:13:58 DEBUG : Using config file from "C:\\Users\\Mark\\AppData\\Roaming\\rclone\\rclone.conf"
2023/08/21 20:13:58 DEBUG : fs cache: renaming cache item "C:\\Users\\Mark\\Documents\\Gnucash\\" to be canonical "//?/C:/Users/Mark/Documents/Gnucash"
2023/08/21 20:13:58 DEBUG : Creating backend with remote "odrive:Mark\\gnucash"
2023/08/21 20:13:59 DEBUG : fs cache: renaming cache item "odrive:Mark\\gnucash" to be canonical "odrive:Mark/gnucash"
2023/08/21 20:13:59 DEBUG : OTP/export.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:13:59 DEBUG : OTP/export.gnucash: Starting multipart upload
2023/08/21 20:14:00 DEBUG : expanses/expanses.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:00 DEBUG : expanses/expanses.gnucash: Starting multipart upload
2023/08/21 20:14:00 DEBUG : OTP/gnu - Copy/zxc.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:00 DEBUG : OTP/gnu - Copy/zxc.gnucash: Starting multipart upload
2023/08/21 20:14:00 DEBUG : OTP/gnu/zxc.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:00 DEBUG : OneDrive root 'Mark/gnucash': Waiting for checks to finish
2023/08/21 20:14:00 DEBUG : OneDrive root 'Mark/gnucash': Waiting for transfers to finish
2023/08/21 20:14:00 DEBUG : OTP/gnu/zxc.gnucash: Starting multipart upload
2023/08/21 20:14:00 DEBUG : expanses/expanses.gnucash: Uploading segment 0/44471 size 44471
2023/08/21 20:14:00 DEBUG : OTP/export.gnucash: Uploading segment 0/15226 size 15226
2023/08/21 20:14:00 DEBUG : OTP/gnu - Copy/zxc.gnucash: Uploading segment 0/62804 size 62804
2023/08/21 20:14:00 DEBUG : OTP/gnu/zxc.gnucash: Uploading segment 0/79715 size 79715
2023/08/21 20:14:01 DEBUG : OTP/gnu - Copy/zxc.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:01 DEBUG : OTP/gnu/zxc.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:01 DEBUG : expanses/expanses.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:01 DEBUG : OTP/export.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:01 NOTICE: OTP/gnu - Copy/zxc.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:01 ERROR : OTP/gnu - Copy/zxc.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:01 NOTICE: OTP/gnu/zxc.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:01 ERROR : OTP/gnu/zxc.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:01 NOTICE: expanses/expanses.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:01 ERROR : expanses/expanses.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:01 NOTICE: OTP/export.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:01 ERROR : OTP/export.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:01 ERROR : OneDrive root 'Mark/gnucash': not deleting files as there were IO errors
2023/08/21 20:14:01 ERROR : OneDrive root 'Mark/gnucash': not deleting directories as there were IO errors
2023/08/21 20:14:01 ERROR : Attempt 1/3 failed with 4 errors and: unauthenticated: Unauthenticated
2023/08/21 20:14:01 DEBUG : OTP/export.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:01 DEBUG : OTP/export.gnucash: Starting multipart upload
2023/08/21 20:14:01 DEBUG : expanses/expanses.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:01 DEBUG : expanses/expanses.gnucash: Starting multipart upload
2023/08/21 20:14:01 DEBUG : OTP/gnu/zxc.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:01 DEBUG : OTP/gnu/zxc.gnucash: Starting multipart upload
2023/08/21 20:14:01 DEBUG : OTP/gnu - Copy/zxc.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:01 DEBUG : OneDrive root 'Mark/gnucash': Waiting for checks to finish
2023/08/21 20:14:01 DEBUG : OneDrive root 'Mark/gnucash': Waiting for transfers to finish
2023/08/21 20:14:01 DEBUG : OTP/gnu - Copy/zxc.gnucash: Starting multipart upload
2023/08/21 20:14:02 DEBUG : OTP/export.gnucash: Uploading segment 0/15226 size 15226
2023/08/21 20:14:02 DEBUG : expanses/expanses.gnucash: Uploading segment 0/44471 size 44471
2023/08/21 20:14:02 DEBUG : OTP/export.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:02 DEBUG : OTP/gnu/zxc.gnucash: Uploading segment 0/79715 size 79715
2023/08/21 20:14:02 DEBUG : expanses/expanses.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:02 NOTICE: OTP/export.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:02 ERROR : OTP/export.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:02 DEBUG : OTP/gnu/zxc.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:02 NOTICE: expanses/expanses.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:02 ERROR : expanses/expanses.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:02 DEBUG : OTP/gnu - Copy/zxc.gnucash: Uploading segment 0/62804 size 62804
2023/08/21 20:14:02 NOTICE: OTP/gnu/zxc.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:02 ERROR : OTP/gnu/zxc.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:02 DEBUG : OTP/gnu - Copy/zxc.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:02 NOTICE: OTP/gnu - Copy/zxc.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:02 ERROR : OTP/gnu - Copy/zxc.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:02 ERROR : OneDrive root 'Mark/gnucash': not deleting files as there were IO errors
2023/08/21 20:14:02 ERROR : OneDrive root 'Mark/gnucash': not deleting directories as there were IO errors
2023/08/21 20:14:02 ERROR : Attempt 2/3 failed with 4 errors and: unauthenticated: Unauthenticated
2023/08/21 20:14:02 DEBUG : expanses/expanses.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:02 DEBUG : expanses/expanses.gnucash: Starting multipart upload
2023/08/21 20:14:03 DEBUG : OTP/export.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:03 DEBUG : OTP/export.gnucash: Starting multipart upload
2023/08/21 20:14:03 DEBUG : OTP/gnu - Copy/zxc.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:03 DEBUG : OTP/gnu - Copy/zxc.gnucash: Starting multipart upload
2023/08/21 20:14:03 DEBUG : OTP/gnu/zxc.gnucash: Need to transfer - File not found at Destination
2023/08/21 20:14:03 DEBUG : OneDrive root 'Mark/gnucash': Waiting for checks to finish
2023/08/21 20:14:03 DEBUG : OneDrive root 'Mark/gnucash': Waiting for transfers to finish
2023/08/21 20:14:03 DEBUG : OTP/gnu/zxc.gnucash: Starting multipart upload
2023/08/21 20:14:03 DEBUG : OTP/export.gnucash: Uploading segment 0/15226 size 15226
2023/08/21 20:14:03 DEBUG : expanses/expanses.gnucash: Uploading segment 0/44471 size 44471
2023/08/21 20:14:03 DEBUG : OTP/export.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:03 DEBUG : expanses/expanses.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:03 NOTICE: OTP/export.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:03 ERROR : OTP/export.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:03 NOTICE: expanses/expanses.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:03 ERROR : expanses/expanses.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:03 DEBUG : OTP/gnu/zxc.gnucash: Uploading segment 0/79715 size 79715
2023/08/21 20:14:03 DEBUG : OTP/gnu - Copy/zxc.gnucash: Uploading segment 0/62804 size 62804
2023/08/21 20:14:03 DEBUG : OTP/gnu - Copy/zxc.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:03 DEBUG : OTP/gnu/zxc.gnucash: Cancelling multipart upload: unauthenticated: Unauthenticated
2023/08/21 20:14:03 NOTICE: OTP/gnu - Copy/zxc.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:03 ERROR : OTP/gnu - Copy/zxc.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:03 NOTICE: OTP/gnu/zxc.gnucash: Failed to cancel multipart upload: unauthenticated: Unauthenticated (upload failed due to: unauthenticated: Unauthenticated)
2023/08/21 20:14:03 ERROR : OTP/gnu/zxc.gnucash: Failed to copy: unauthenticated: Unauthenticated
2023/08/21 20:14:03 ERROR : OneDrive root 'Mark/gnucash': not deleting files as there were IO errors
2023/08/21 20:14:03 ERROR : OneDrive root 'Mark/gnucash': not deleting directories as there were IO errors
2023/08/21 20:14:03 ERROR : Attempt 3/3 failed with 4 errors and: unauthenticated: Unauthenticated
2023/08/21 20:14:03 INFO  :
Transferred:      592.430 KiB / 592.430 KiB, 100%, 130.706 KiB/s, ETA 0s
Errors:                 4 (retrying may help)
Elapsed time:         5.0s

2023/08/21 20:14:03 DEBUG : 17 go routines active
2023/08/21 20:14:03 Failed to sync with 4 errors: last error was: unauthenticated: Unauthenticated

welcome to the forum,

I agree that it is always good idea to create own client id/secret. But default rclone one should work anyway. I have tested myself right now - there is no issue with default client id/secret.

@MarkMan0 - you mentioned that it is Microsoft OneDrive Personal - is it part of Office 365? Or maybe something else like educational one?

Everything you posted looks 100% correct - there is no obvious reason for sync to fail.

It's Microsoft 365 Basic, not a student license. The naming of these things is confusing, just bough the cheapest one LOL. It's the 20€/year one, which includes 100GB of storage. The other plans do say "works on PC, Mac..." so I hope it's not some bullshit from MS pushing for the more expensive options... Which subscription did you try it with?

I never used Microsoft 365 Basic. rclone works with personal from Office 365 and Business - these are ones I tested.

Can you add --dump headers flag to your sync and post output here? Maybe it will tell us a bit more what is going on.

Also as @asdffdsa suggested add --retries=1 - we do not need repeating errors - we know that something is wrong.

This BTW is not so cheap:) with e.g. iDrive you get 1TB for the same money.

1 Like

correct,
tho that was intended to test the account itself and to see if account supports the basic permissions that rclone will ask for.

to copy a one-byte text file, that was to rule out multipart uploads issues.

I have also tested now super basic:) onedrive free version - 5GB of storage with this "plan". All rclone works no issues. So I would be surprised if this is this particular subscription issue.

yes, i use that and it works with rclone.

I just tried the secret method, but the same result. Google drive works flawlessly though..

ok, good, now we know that office365 basic works with rclone.
can you post the redacted config?

i would try this, then i think we should have all the basic info.
rclone copy --retries=1 --vv --dump=headers a single text file of size one-byte

I'm another user with the same problem: OneDrive spews "Unauthenticated" errors. This started a few weeks ago. I suspect it's because my access token had expired.
I've deleted my old 'remotes' and created new one using 'rclone config'.
No ClientID, no secret.
A newly-created token includes an "expiry" value showing the time of creation. Do newly-created access tokens expire immediately for Microsoft OneDrive?
Rclone is latest, v1.63.1. I used "rclone selfupdate" today.

Command line used:
rclone copy onechar.txt MSFT823: --retries=1 --dump=headers > rclone_output.txt 2>&1

Output is attached. (Thanks ncw / Nick Craig-Wood for the quick update of trust level so I could do the upload!)

Thanks,
Rich / TangoBravoMike
rclone_output.txt (13.9 KB)

@Cnly - as you are listed as maintainer of onedrive backend could you please have a look at this problem?

@MarkMan0 @TangoBravoMike - could you verify that date and time of your computers is correct? If not that it often leads to problems with authentication.

@kapitainsky - I use NetTime on my Windows laptop. See
NetTime
It keeps the computer's time fairly well synchronized. I checked NIST just now and it reports my computer time error as +0.019 seconds. Probably good enough.
Thanks!
TangoBravoMike

It's set by Windows automatically, so it's correct for me too. And I don't use any kind of VPN, so it should be correct for my location

Here's the output. I've deleted some hash-looking string from an URL for the tempauth key. Wasn't sure if that was safe to upload to the internet. Rest is untouched.

https://pastebin.com/WNXT70YP

  • i believe with S3, if even the region is set wrong, can list files but not transfer; might be the same with onedrive.
    try hardcoding the region
    --onedrive-region=de

  • might try --multi-thread-streams=0 to eliminate any issues with multipart.

  • can you download files from onedrive to local?

  • please post the latest redacted config

what did you choose here?

Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
 1 / Microsoft Cloud Global
   \ (global)
 2 / Microsoft Cloud for US Government
   \ (us)
 3 / Microsoft Cloud Germany
   \ (de)
 4 / Azure and Office 365 operated by Vnet Group in China
   \ (cn)
region>

@asdffdsa: When you say "post the latest redacted config" do you mean the console output produced when we run 'rclone config' to create a new remote? And what should we redact?
My console output is attached.

Adding --multi-thread-streams=0 made no difference. Still 'Unauthenticated'.
I can not download files from OneDrive. Also produces 'Unauthenticated'.

@MarkMan0: I'm not trying to hijack your thread, just offering input that may help shed light. I'll keep a light footprint here, hoping for good answers.
rclone_config_MSFT823.txt (7.6 KB)

Trying again to give you the information you need.
I found that the configuration file containing remote information is at
C:\Users<username>\AppData\Roaming\rclone\rclone.conf
I created a new remote today, pointed at Microsoft Onedrive Personal. No client ID, no secret.

Attached:

  • Excerpt from the rclone.conf file for the newly-created remote.
  • The output of the 'rclone config' session which created the new remote.
  • Dump output from an rclone session which attempted to retrieve an existing file. You can see the command line parameters at the top of the dump output. Result is "Unauthenticated".

I see this in the dump output:
2023/08/26 23:45:09 DEBUG : OneDrive root 'bat': Token expired but no uploads in progress - doing nothing

How can I define a remote that has some useful life left in it? A year would be good!

config_new_remote.txt (1.7 KB)
rclone_config_20230826.txt (7.3 KB)
rclone_retrieve_output230826.txt (15.0 KB)

Thanks VERY MUCH for any light you can shed on this access problem.
Rich / TangoBravoMike