Infinite loop with HTTP 401 errors during "config create" / Onedrive

What is the problem you are having with rclone?

When I use the command line (non interactive) to create a onedrive remote configuration, I get an infinite loop with the following error message: "Failed to query available drives: HTTP error 401 (401 Unauthorized)". Even though my console is fulfilled with error messages, I can still use the recently created remote configuration successfully after I interrupt the error loop with CTRL+C. I don't have the problem when i use the interactive menus to create the remote configuration.

It can be seen that rclone is trying to access the "/v1.0/me/drives" endpoint. In my company, the selected user does not have access to this endpoint, so the HTTP 401 error should be expected in this case. Nevertheless, it seems that rclone should not call this endpoint since I have already given the driveId that I want to connect into.

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

In this topic, I used the v1.59.0-beta version, but the same problem was detected in all versions above v1.56.0.

$ ./rclone --version
rclone v1.59.0-beta.6078.bab91e440
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 5.13.0-37-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.18.1
- go/linking: static
- go/tags: none

Running exaclty the same "rclone config create" command, the problem was NOT detect from versions v1.54.0 to v1.55.1 (I didn't test it before v1.54):

rclone v1.55.1
- os/type: linux
- os/arch: amd64
- go/version: go1.16.3
- go/linking: static
- go/tags: none

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

OneDrive / business

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

rclone config create my_test onedrive client_id [CENSORED] client_secret [CENSORED] region global drive_type documentLibrary drive_id [CENSORED]

The rclone config contents with secrets removed.

[my_test]
type = onedrive
region = global
drive_type = documentLibrary
drive_id = [CENSORED]
client_id = [CENSORED]
client_secret = [CENSORED]
token = [CENSORED]

A log from the command with the -vv flag

First, these are the logs without -vv

<5>NOTICE: Make sure your Redirect URL is set to "[LOCALHOST URL]" in your custom config.
<5>NOTICE: If your browser doesn't open automatically go to the following link: [LOCALHOST URL]
<5>NOTICE: Log in and authorize rclone for access
<5>NOTICE: Waiting for code...
<5>NOTICE: Got code
Failed to query available drives: HTTP error 401 (401 Unauthorized) returned body: "{\"error\":{\"code\":\"accessDenied\",\"message\":\"There has been an error authenticating the request.\",\"innerError\":{\"date\":\"2022-04-20T01:40:49\",\"request-id\":\"208470a6-80ed-4b3d-83a9-56c8dffc3d0e\",\"client-request-id\":\"208470a6-80ed-4b3d-83a9-56c8dffc3d0e\"}}}"
Failed to query available drives: HTTP error 401 (401 Unauthorized) returned body: "{\"error\":{\"code\":\"accessDenied\",\"message\":\"There has been an error authenticating the request.\",\"innerError\":{\"date\":\"2022-04-20T01:40:49\",\"request-id\":\"44ae3370-ded9-427c-9a2d-2b733709d952\",\"client-request-id\":\"44ae3370-ded9-427c-9a2d-2b733709d952\"}}}"
Failed to query available drives: HTTP error 401 (401 Unauthorized) returned body: "{\"error\":{\"code\":\"accessDenied\",\"message\":\"There has been an error authenticating the request.\",\"innerError\":{\"date\":\"2022-04-20T01:40:49\",\"request-id\":\"1e1ece8f-a384-4e67-9e8b-9a3bc78c3ba2\",\"client-request-id\":\"1e1ece8f-a384-4e67-9e8b-9a3bc78c3ba2\"}}}"
Failed to query available drives: HTTP error 401 (401 Unauthorized) returned body: "{\"error\":{\"code\":\"accessDenied\",\"message\":\"There has been an error authenticating the request.\",\"innerError\":{\"date\":\"2022-04-20T01:40:49\",\"request-id\":\"3a3b5a7b-8c4c-48cd-94aa-4bd3d1bb1a6f\",\"client-request-id\":\"3a3b5a7b-8c4c-48cd-94aa-4bd3d1bb1a6f\"}}}"
Failed to query available drives: HTTP error 401 (401 Unauthorized) returned body: "{\"error\":{\"code\":\"accessDenied\",\"message\":\"There has been an error authenticating the request.\",\"innerError\":{\"date\":\"2022-04-20T01:40:50\",\"request-id\":\"41ba9d48-c2d8-42e2-8994-88a774175352\",\"client-request-id\":\"41ba9d48-c2d8-42e2-8994-88a774175352\"}}}"
Failed to query available drives: HTTP error 401 (401 Unauthorized) returned body: "{\"error\":{\"code\":\"accessDenied\",\"message\":\"There has been an error authenticating the request.\",\"innerError\":{\"date\":\"2022-04-20T01:40:50\",\"request-id\":\"504e5715-e660-4338-ba45-657327a238ec\",\"client-request-id\":\"504e5715-e660-4338-ba45-657327a238ec\"}}}"

[... This error repeats indefinitely ...]

Now, here are the logs with -vv --dump bodies:
https://pastebin.com/raw/5tny75By

I think adding config_type drive_id to your setup should fix the infinite loop. You might need to add another one for setting the drive id or maybe it will take the default at that point...

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