Box remote won't auto-refresh access token

What is the problem you are having with rclone?

I'm trying to sync all the files on my Google Shared Drive remote to a new Box Business remote but I'm having problems with the refresh token. I'm using JWT for access and rclone config has the client ID/secret. The relevant config is below.

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

rclone v1.64.0-beta.7174.3ed4a2e96
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 5.15.0-78-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21rc3
- go/linking: static
- go/tags: none

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

Box

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

None of the commands I'm running on the box remote work (including lsd, copy, sync, or size) after an hour from the last refresh token. Per Box's documentation, this behavior is expected as the token needs to be refreshed after 60 minutes. So in order to refresh, I have to run rclone config reconnect box:, and then everything runs as it should again for 60 minutes. Rinse and repeat.

The rclone config contents with secrets removed.

[box]
type = box
client_id = [redacted]
client_secret = [redacted]
box_config_file = /opt/sa-creds/box_config.json
root_folder_id = [redacted]
box_sub_type = enterprise
token = {"access_token":"[redacted].","token_type":"bearer","expiry":"2023-07-25T20:50:17.267151799-05:00"}

[box_chunker]
type = chunker
remote = box:
chunk_size = 4.9Gi
name_format = * - [Chunk #####]

A log from the command with the -vv flag

When running rclone lsd box:, I get the error below. Other commands show essentially the same error.

2023/07/25 20:51:32 ERROR : : error listing: couldn't list files: Get "https://api.box.com/2.0/folders/218658551144/items?fields=type%2Cid%2Csequence_id%2Cetag%2Csha1%2Cname%2Csize%2Ccreated_at%2Cmodified_at%2Ccontent_created_at%2Ccontent_modified_at%2Citem_status%2Cshared_link%2Cowned_by&limit=1000&usemarker=true": token expired and there's no refresh token - manually refresh with "rclone config reconnect box:"
2023/07/25 20:51:32 Failed to lsd with 2 errors: last error was: couldn't list files: Get "https://api.box.com/2.0/folders/218658551144/items?fields=type%2Cid%2Csequence_id%2Cetag%2Csha1%2Cname%2Csize%2Ccreated_at%2Cmodified_at%2Ccontent_created_at%2Ccontent_modified_at%2Citem_status%2Cshared_link%2Cowned_by&limit=1000&usemarker=true": token expired and there's no refresh token - manually refresh with "rclone config reconnect box:"

Edit:

I figured it could be useful to include my box_config.json file as well, although not much left after removing private data:

{
  "boxAppSettings": {
    "clientID": "[redacted]",
    "clientSecret": "[redacted]",
    "appAuth": {
      "publicKeyID": "w1cw2pf2",
      "privateKey": "-----BEGIN ENCRYPTED PRIVATE KEY-----[redacted]-----END ENCRYPTED PRIVATE KEY-----\n",
      "passphrase": "[redacted]"
    }
  },
  "enterpriseID": "[redacted]"
}

Rclone should be refreshing the token for you so you should not have to run rclone reconnect.

Is the time *and timezone correct on the server? If not this can cause the token not to be refreshed.

If you run with -vv do you see rclone trying to refresh the token?

Thanks for the reply @ncw. Here's the full output of rclone lsd box: -vv:

2023/07/26 10:11:29 DEBUG : rclone: Version "v1.64.0-beta.7174.3ed4a2e96" starting with parameters ["rclone" "lsd" "box:" "-vv"]
2023/07/26 10:11:29 DEBUG : Creating backend with remote "box:"
2023/07/26 10:11:29 DEBUG : Using config file from "~/.config/rclone/rclone.conf"
2023/07/26 10:11:29 DEBUG : box root '': Token expired - 1 uploads in progress - refreshing
2023/07/26 10:11:29 DEBUG : box: Loaded invalid token from config file - ignoring
2023/07/26 10:11:29 ERROR : : error listing: couldn't list files: Get "https://api.box.com/2.0/folders/218658551144/items?fields=type%2Cid%2Csequence_id%2Cetag%2Csha1%2Cname%2Csize%2Ccreated_at%2Cmodified_at%2Ccontent_created_at%2Ccontent_modified_at%2Citem_status%2Cshared_link%2Cowned_by&limit=1000&usemarker=true": token expired and there's no refresh token - manually refresh with "rclone config reconnect box:"
2023/07/26 10:11:29 DEBUG : 6 go routines active
2023/07/26 10:11:29 Failed to lsd with 2 errors: last error was: couldn't list files: Get "https://api.box.com/2.0/folders/218658551144/items?fields=type%2Cid%2Csequence_id%2Cetag%2Csha1%2Cname%2Csize%2Ccreated_at%2Cmodified_at%2Ccontent_created_at%2Ccontent_modified_at%2Citem_status%2Cshared_link%2Cowned_by&limit=1000&usemarker=true": token expired and there's no refresh token - manually refresh with "rclone config reconnect box:"

It says "1 upload in progress" but there is no upload going. I even re-ran the command immediately after a fresh reboot to ensure there wasn't something going on in the background. I don't know if that's actually related to the error either though, just caught my eye.

This means that the token you got from box didn't have a refresh token so rclone couldn't refresh it.

This might be a setting in your client_id that needs fixing. Google drive does this when your client_id isn't set to public but I'm not sure about box. That should give you an area to look at.

Box's API is confusing, even compared to Google to be honest. I've gone through their API documentation trying to figure out how to manually obtain a refresh token when using their "Custom App" type with the various authentication types available through their dev interface and Postman, but just ended up giving up. I just created a remote using the "Limited Access App" which seems to work fine. Not exactly sure why a custom app would have a different authentication workflow but who knows...

1 Like

I have the same issue with box not refreshing the token. config.json is the the same as the OP.

.rclone.conf (permissions 600)

[box]
type = box
client_id = **REDACTED**
client_secret = **REDACTED**
box_config_file = /path/to/config.json
box_sub_type = enterprise
token = {"access_token":"**REDACTED**","token_type":"bearer","expiry":"2023-08-04T19:28:20.114244464+10:00"}

[box_enc]
type = crypt
remote = box:
filename_encryption = standard
directory_name_encryption = true
password = **REDACTED**
password2 = **REDACTED**

[box_enc_ch]
type = chunker
remote = box_enc:
chunk_size = 4900M
hash_type = sha1

running an rclone copy here (with a 10.1GB test file) with DEBUG log shows it refreshes the token once succesfully, but fails to do it again a second time.

2023/08/04 17:16:14 INFO  : Starting transaction limiter: max 10 transactions/s with burst 10
2023/08/04 17:16:14 DEBUG : rclone: Version "v1.63.1" starting with parameters ["rclone" "--log-level" "DEBUG" "--tpslimit" "10" "--tpslimit-burst" "10" "-P" "--box-box-config-file=/path/to/config.json" "--log-file=/tmp/box.log" "copy" "test.mkv" "box_enc_ch:test/upload/path"]
2023/08/04 17:16:14 DEBUG : Creating backend with remote "test.mkv"
2023/08/04 17:16:14 DEBUG : Using config file from "/path/to/.rclone.conf"
2023/08/04 17:16:14 DEBUG : fs cache: adding new entry for parent of "test.mkv", "/"
2023/08/04 17:16:14 DEBUG : Creating backend with remote "box_enc_ch:test/upload/path"
2023/08/04 17:16:14 DEBUG : Creating backend with remote "box_enc:test/upload/path"
2023/08/04 17:16:14 DEBUG : Creating backend with remote "box:**REDACTED**"
2023/08/04 17:16:14 DEBUG : box: detected overridden config - adding "{EOkOO}" suffix to name
2023/08/04 17:16:17 DEBUG : fs cache: renaming cache item "box:**REDACTED**" to be canonical "box{EOkOO}:**REDACTED**"
2023/08/04 17:16:17 DEBUG : fs cache: switching user supplied name "box:**REDACTED**" for canonical name "box{EOkOO}:**REDACTED**"
2023/08/04 17:16:17 DEBUG : Reset feature "ListR"
2023/08/04 17:16:17 DEBUG : test.mkv: Need to transfer - File not found at Destination
2023/08/04 17:16:18 DEBUG : test.mkv: skip slow SHA1 on source file, hashing in-transit
2023/08/04 17:16:19 DEBUG : **REDACTED**: Multipart upload session started for 77 parts of size 64Mi
2023/08/04 17:16:20 DEBUG : **REDACTED**: Uploading part 1/77 offset 0/4.786Gi part size 64Mi
2023/08/04 17:16:21 DEBUG : **REDACTED**: Uploading part 2/77 offset 64Mi/4.786Gi part size 64Mi
2023/08/04 17:16:22 DEBUG : **REDACTED**: Uploading part 3/77 offset 128Mi/4.786Gi part size 64Mi
2023/08/04 17:16:23 DEBUG : **REDACTED**: Uploading part 4/77 offset 192Mi/4.786Gi part size 64Mi
2023/08/04 17:18:12 DEBUG : **REDACTED**: Uploading part 5/77 offset 256Mi/4.786Gi part size 64Mi
2023/08/04 17:18:13 DEBUG : **REDACTED**: Uploading part 6/77 offset 320Mi/4.786Gi part size 64Mi
2023/08/04 17:18:22 DEBUG : **REDACTED**: Uploading part 7/77 offset 384Mi/4.786Gi part size 64Mi
2023/08/04 17:18:23 DEBUG : **REDACTED**: Uploading part 8/77 offset 448Mi/4.786Gi part size 64Mi
2023/08/04 17:20:09 DEBUG : **REDACTED**: Uploading part 9/77 offset 512Mi/4.786Gi part size 64Mi
2023/08/04 17:20:10 DEBUG : **REDACTED**: Uploading part 10/77 offset 576Mi/4.786Gi part size 64Mi
2023/08/04 17:20:16 DEBUG : **REDACTED**: Uploading part 11/77 offset 640Mi/4.786Gi part size 64Mi
2023/08/04 17:20:17 DEBUG : **REDACTED**: Uploading part 12/77 offset 704Mi/4.786Gi part size 64Mi
2023/08/04 17:21:20 DEBUG : box root '**REDACTED**': Token expired - 2 uploads in progress - refreshing
2023/08/04 17:21:22 DEBUG : jwtutil: Response Body: {"access_token":"**REDACTED**","expires_in":3951,"restricted_to":[],"token_type":"bearer"}
2023/08/04 17:21:22 DEBUG : Saving config "token" in section "box" of the config file
2023/08/04 17:21:22 DEBUG : Keeping previous permissions for config file: -rw-r--r--
2023/08/04 17:21:22 DEBUG : box{EOkOO}: Saved new token in config file
2023/08/04 17:21:22 DEBUG : box root '**REDACTED**': Token refresh successful
2023/08/04 17:22:05 DEBUG : **REDACTED**: Uploading part 13/77 offset 768Mi/4.786Gi part size 64Mi
2023/08/04 17:22:05 DEBUG : box{EOkOO}: Loaded fresh token from config file
2023/08/04 17:22:08 DEBUG : **REDACTED**: Uploading part 14/77 offset 832Mi/4.786Gi part size 64Mi
2023/08/04 17:22:10 DEBUG : **REDACTED**: Uploading part 15/77 offset 896Mi/4.786Gi part size 64Mi
2023/08/04 17:22:12 DEBUG : **REDACTED**: Uploading part 16/77 offset 960Mi/4.786Gi part size 64Mi
2023/08/04 17:24:00 DEBUG : **REDACTED**: Uploading part 17/77 offset 1Gi/4.786Gi part size 64Mi
2023/08/04 17:24:02 DEBUG : **REDACTED**: Uploading part 18/77 offset 1.062Gi/4.786Gi part size 64Mi
2023/08/04 17:24:07 DEBUG : **REDACTED**: Uploading part 19/77 offset 1.125Gi/4.786Gi part size 64Mi
2023/08/04 17:24:09 DEBUG : **REDACTED**: Uploading part 20/77 offset 1.188Gi/4.786Gi part size 64Mi
2023/08/04 17:25:52 DEBUG : **REDACTED**: Uploading part 21/77 offset 1.250Gi/4.786Gi part size 64Mi
2023/08/04 17:26:00 DEBUG : **REDACTED**: Uploading part 22/77 offset 1.312Gi/4.786Gi part size 64Mi
2023/08/04 17:26:03 DEBUG : **REDACTED**: Uploading part 23/77 offset 1.375Gi/4.786Gi part size 64Mi
2023/08/04 17:26:04 DEBUG : **REDACTED**: Uploading part 24/77 offset 1.438Gi/4.786Gi part size 64Mi
2023/08/04 17:27:48 DEBUG : **REDACTED**: Uploading part 25/77 offset 1.500Gi/4.786Gi part size 64Mi
2023/08/04 17:27:57 DEBUG : **REDACTED**: Uploading part 26/77 offset 1.562Gi/4.786Gi part size 64Mi
2023/08/04 17:27:58 DEBUG : **REDACTED**: Uploading part 27/77 offset 1.625Gi/4.786Gi part size 64Mi
2023/08/04 17:28:03 DEBUG : **REDACTED**: Uploading part 28/77 offset 1.688Gi/4.786Gi part size 64Mi
2023/08/04 17:29:39 DEBUG : **REDACTED**: Uploading part 29/77 offset 1.750Gi/4.786Gi part size 64Mi
2023/08/04 17:29:49 DEBUG : **REDACTED**: Uploading part 30/77 offset 1.812Gi/4.786Gi part size 64Mi
2023/08/04 17:29:52 DEBUG : **REDACTED**: Uploading part 31/77 offset 1.875Gi/4.786Gi part size 64Mi
2023/08/04 17:30:05 DEBUG : **REDACTED**: Uploading part 32/77 offset 1.938Gi/4.786Gi part size 64Mi
2023/08/04 17:31:35 DEBUG : **REDACTED**: Uploading part 33/77 offset 2Gi/4.786Gi part size 64Mi
2023/08/04 17:31:49 DEBUG : **REDACTED**: Uploading part 34/77 offset 2.062Gi/4.786Gi part size 64Mi
2023/08/04 17:31:50 DEBUG : **REDACTED**: Uploading part 35/77 offset 2.125Gi/4.786Gi part size 64Mi
2023/08/04 17:31:56 DEBUG : **REDACTED**: Uploading part 36/77 offset 2.188Gi/4.786Gi part size 64Mi
2023/08/04 17:33:30 DEBUG : **REDACTED**: Uploading part 37/77 offset 2.250Gi/4.786Gi part size 64Mi
2023/08/04 17:33:43 DEBUG : **REDACTED**: Uploading part 38/77 offset 2.312Gi/4.786Gi part size 64Mi
2023/08/04 17:33:52 DEBUG : **REDACTED**: Uploading part 39/77 offset 2.375Gi/4.786Gi part size 64Mi
2023/08/04 17:33:58 DEBUG : **REDACTED**: Uploading part 40/77 offset 2.438Gi/4.786Gi part size 64Mi
2023/08/04 17:35:23 DEBUG : **REDACTED**: Uploading part 41/77 offset 2.500Gi/4.786Gi part size 64Mi
2023/08/04 17:35:43 DEBUG : **REDACTED**: Uploading part 42/77 offset 2.562Gi/4.786Gi part size 64Mi
2023/08/04 17:35:57 DEBUG : **REDACTED**: Uploading part 43/77 offset 2.625Gi/4.786Gi part size 64Mi
2023/08/04 17:35:58 DEBUG : **REDACTED**: Uploading part 44/77 offset 2.688Gi/4.786Gi part size 64Mi
2023/08/04 17:37:26 DEBUG : **REDACTED**: Uploading part 45/77 offset 2.750Gi/4.786Gi part size 64Mi
2023/08/04 17:37:34 DEBUG : **REDACTED**: Uploading part 46/77 offset 2.812Gi/4.786Gi part size 64Mi
2023/08/04 17:37:55 DEBUG : **REDACTED**: Uploading part 47/77 offset 2.875Gi/4.786Gi part size 64Mi
2023/08/04 17:37:56 DEBUG : **REDACTED**: Uploading part 48/77 offset 2.938Gi/4.786Gi part size 64Mi
2023/08/04 17:39:22 DEBUG : **REDACTED**: Uploading part 49/77 offset 3Gi/4.786Gi part size 64Mi
2023/08/04 17:39:35 DEBUG : **REDACTED**: Uploading part 50/77 offset 3.062Gi/4.786Gi part size 64Mi
2023/08/04 17:39:55 DEBUG : **REDACTED**: Uploading part 51/77 offset 3.125Gi/4.786Gi part size 64Mi
2023/08/04 17:39:56 DEBUG : **REDACTED**: Uploading part 52/77 offset 3.188Gi/4.786Gi part size 64Mi
2023/08/04 17:41:19 DEBUG : **REDACTED**: Uploading part 53/77 offset 3.250Gi/4.786Gi part size 64Mi
2023/08/04 17:41:32 DEBUG : **REDACTED**: Uploading part 54/77 offset 3.312Gi/4.786Gi part size 64Mi
2023/08/04 17:41:55 DEBUG : **REDACTED**: Uploading part 55/77 offset 3.375Gi/4.786Gi part size 64Mi
2023/08/04 17:41:56 DEBUG : **REDACTED**: Uploading part 56/77 offset 3.438Gi/4.786Gi part size 64Mi
2023/08/04 17:43:12 DEBUG : **REDACTED**: Uploading part 57/77 offset 3.500Gi/4.786Gi part size 64Mi
2023/08/04 17:43:33 DEBUG : **REDACTED**: Uploading part 58/77 offset 3.562Gi/4.786Gi part size 64Mi
2023/08/04 17:43:48 DEBUG : **REDACTED**: Uploading part 59/77 offset 3.625Gi/4.786Gi part size 64Mi
2023/08/04 17:43:55 DEBUG : **REDACTED**: Uploading part 60/77 offset 3.688Gi/4.786Gi part size 64Mi
2023/08/04 17:45:07 DEBUG : **REDACTED**: Uploading part 61/77 offset 3.750Gi/4.786Gi part size 64Mi
2023/08/04 17:45:29 DEBUG : **REDACTED**: Uploading part 62/77 offset 3.812Gi/4.786Gi part size 64Mi
2023/08/04 17:45:49 DEBUG : **REDACTED**: Uploading part 63/77 offset 3.875Gi/4.786Gi part size 64Mi
2023/08/04 17:45:51 DEBUG : **REDACTED**: Uploading part 64/77 offset 3.938Gi/4.786Gi part size 64Mi
2023/08/04 17:47:02 DEBUG : **REDACTED**: Uploading part 65/77 offset 4Gi/4.786Gi part size 64Mi
2023/08/04 17:47:34 DEBUG : **REDACTED**: Uploading part 66/77 offset 4.062Gi/4.786Gi part size 64Mi
2023/08/04 17:47:43 DEBUG : **REDACTED**: Uploading part 67/77 offset 4.125Gi/4.786Gi part size 64Mi
2023/08/04 17:47:44 DEBUG : **REDACTED**: Uploading part 68/77 offset 4.188Gi/4.786Gi part size 64Mi
2023/08/04 17:48:58 DEBUG : **REDACTED**: Uploading part 69/77 offset 4.250Gi/4.786Gi part size 64Mi
2023/08/04 17:49:25 DEBUG : **REDACTED**: Uploading part 70/77 offset 4.312Gi/4.786Gi part size 64Mi
2023/08/04 17:49:44 DEBUG : **REDACTED**: Uploading part 71/77 offset 4.375Gi/4.786Gi part size 64Mi
2023/08/04 17:49:45 DEBUG : **REDACTED**: Uploading part 72/77 offset 4.438Gi/4.786Gi part size 64Mi
2023/08/04 17:50:52 DEBUG : **REDACTED**: Uploading part 73/77 offset 4.500Gi/4.786Gi part size 64Mi
2023/08/04 17:51:25 DEBUG : **REDACTED**: Uploading part 74/77 offset 4.562Gi/4.786Gi part size 64Mi
2023/08/04 17:51:40 DEBUG : **REDACTED**: Uploading part 75/77 offset 4.625Gi/4.786Gi part size 64Mi
2023/08/04 17:51:42 DEBUG : **REDACTED**: Uploading part 76/77 offset 4.688Gi/4.786Gi part size 64Mi
2023/08/04 17:52:48 DEBUG : **REDACTED**: Uploading part 77/77 offset 4.750Gi/4.786Gi part size 64Mi
2023/08/04 17:53:39 DEBUG : **REDACTED**: commit multipart upload failed 1/100 - trying again in 30 seconds (not ready yet)
2023/08/04 17:54:11 DEBUG : test.mkv: sha1 = **REDACTED** OK
2023/08/04 17:54:13 DEBUG : **REDACTED**: Multipart upload session started for 77 parts of size 64Mi
2023/08/04 17:54:14 DEBUG : **REDACTED**: Uploading part 1/77 offset 0/4.786Gi part size 64Mi
2023/08/04 17:54:14 DEBUG : **REDACTED**: Uploading part 2/77 offset 64Mi/4.786Gi part size 64Mi
2023/08/04 17:54:15 DEBUG : **REDACTED**: Uploading part 3/77 offset 128Mi/4.786Gi part size 64Mi
2023/08/04 17:54:16 DEBUG : **REDACTED**: Uploading part 4/77 offset 192Mi/4.786Gi part size 64Mi
2023/08/04 17:56:09 DEBUG : **REDACTED**: Uploading part 5/77 offset 256Mi/4.786Gi part size 64Mi
2023/08/04 17:56:10 DEBUG : **REDACTED**: Uploading part 6/77 offset 320Mi/4.786Gi part size 64Mi
2023/08/04 17:56:12 DEBUG : **REDACTED**: Uploading part 7/77 offset 384Mi/4.786Gi part size 64Mi
2023/08/04 17:56:13 DEBUG : **REDACTED**: Uploading part 8/77 offset 448Mi/4.786Gi part size 64Mi
2023/08/04 17:58:04 DEBUG : **REDACTED**: Uploading part 9/77 offset 512Mi/4.786Gi part size 64Mi
2023/08/04 17:58:08 DEBUG : **REDACTED**: Uploading part 10/77 offset 576Mi/4.786Gi part size 64Mi
2023/08/04 17:58:09 DEBUG : **REDACTED**: Uploading part 11/77 offset 640Mi/4.786Gi part size 64Mi
2023/08/04 17:58:10 DEBUG : **REDACTED**: Uploading part 12/77 offset 704Mi/4.786Gi part size 64Mi
2023/08/04 17:59:59 DEBUG : **REDACTED**: Uploading part 13/77 offset 768Mi/4.786Gi part size 64Mi
2023/08/04 18:00:01 DEBUG : **REDACTED**: Uploading part 14/77 offset 832Mi/4.786Gi part size 64Mi
2023/08/04 18:00:02 DEBUG : **REDACTED**: Uploading part 15/77 offset 896Mi/4.786Gi part size 64Mi
2023/08/04 18:00:09 DEBUG : **REDACTED**: Uploading part 16/77 offset 960Mi/4.786Gi part size 64Mi
2023/08/04 18:01:53 DEBUG : **REDACTED**: Uploading part 17/77 offset 1Gi/4.786Gi part size 64Mi
2023/08/04 18:01:58 DEBUG : **REDACTED**: Uploading part 18/77 offset 1.062Gi/4.786Gi part size 64Mi
2023/08/04 18:01:59 DEBUG : **REDACTED**: Uploading part 19/77 offset 1.125Gi/4.786Gi part size 64Mi
2023/08/04 18:02:06 DEBUG : **REDACTED**: Uploading part 20/77 offset 1.188Gi/4.786Gi part size 64Mi
2023/08/04 18:03:48 DEBUG : **REDACTED**: Uploading part 21/77 offset 1.250Gi/4.786Gi part size 64Mi
2023/08/04 18:03:50 DEBUG : **REDACTED**: Uploading part 22/77 offset 1.312Gi/4.786Gi part size 64Mi
2023/08/04 18:03:56 DEBUG : **REDACTED**: Uploading part 23/77 offset 1.375Gi/4.786Gi part size 64Mi
2023/08/04 18:04:04 DEBUG : **REDACTED**: Uploading part 24/77 offset 1.438Gi/4.786Gi part size 64Mi
2023/08/04 18:05:45 DEBUG : **REDACTED**: Uploading part 25/77 offset 1.500Gi/4.786Gi part size 64Mi
2023/08/04 18:05:48 DEBUG : **REDACTED**: Uploading part 26/77 offset 1.562Gi/4.786Gi part size 64Mi
2023/08/04 18:05:51 DEBUG : **REDACTED**: Uploading part 27/77 offset 1.625Gi/4.786Gi part size 64Mi
2023/08/04 18:05:55 DEBUG : **REDACTED**: Uploading part 28/77 offset 1.688Gi/4.786Gi part size 64Mi
2023/08/04 18:07:41 DEBUG : **REDACTED**: Uploading part 29/77 offset 1.750Gi/4.786Gi part size 64Mi
2023/08/04 18:07:44 DEBUG : **REDACTED**: Uploading part 30/77 offset 1.812Gi/4.786Gi part size 64Mi
2023/08/04 18:07:45 DEBUG : **REDACTED**: Uploading part 31/77 offset 1.875Gi/4.786Gi part size 64Mi
2023/08/04 18:07:55 DEBUG : **REDACTED**: Uploading part 32/77 offset 1.938Gi/4.786Gi part size 64Mi
2023/08/04 18:09:33 DEBUG : **REDACTED**: Uploading part 33/77 offset 2Gi/4.786Gi part size 64Mi
2023/08/04 18:09:40 DEBUG : **REDACTED**: Uploading part 34/77 offset 2.062Gi/4.786Gi part size 64Mi
2023/08/04 18:09:42 DEBUG : **REDACTED**: Uploading part 35/77 offset 2.125Gi/4.786Gi part size 64Mi
2023/08/04 18:09:49 DEBUG : **REDACTED**: Uploading part 36/77 offset 2.188Gi/4.786Gi part size 64Mi
2023/08/04 18:11:26 DEBUG : **REDACTED**: Uploading part 37/77 offset 2.250Gi/4.786Gi part size 64Mi
2023/08/04 18:11:34 DEBUG : **REDACTED**: Uploading part 38/77 offset 2.312Gi/4.786Gi part size 64Mi
2023/08/04 18:11:38 DEBUG : **REDACTED**: Uploading part 39/77 offset 2.375Gi/4.786Gi part size 64Mi
2023/08/04 18:11:51 DEBUG : **REDACTED**: Uploading part 40/77 offset 2.438Gi/4.786Gi part size 64Mi
2023/08/04 18:13:22 DEBUG : **REDACTED**: Uploading part 41/77 offset 2.500Gi/4.786Gi part size 64Mi
2023/08/04 18:13:29 DEBUG : **REDACTED**: Uploading part 42/77 offset 2.562Gi/4.786Gi part size 64Mi
2023/08/04 18:13:33 DEBUG : **REDACTED**: Uploading part 43/77 offset 2.625Gi/4.786Gi part size 64Mi
2023/08/04 18:13:45 DEBUG : **REDACTED**: Uploading part 44/77 offset 2.688Gi/4.786Gi part size 64Mi
2023/08/04 18:15:21 DEBUG : **REDACTED**: Uploading part 45/77 offset 2.750Gi/4.786Gi part size 64Mi
2023/08/04 18:15:27 DEBUG : **REDACTED**: Uploading part 46/77 offset 2.812Gi/4.786Gi part size 64Mi
2023/08/04 18:15:28 DEBUG : **REDACTED**: Uploading part 47/77 offset 2.875Gi/4.786Gi part size 64Mi
2023/08/04 18:15:37 DEBUG : **REDACTED**: Uploading part 48/77 offset 2.938Gi/4.786Gi part size 64Mi
2023/08/04 18:17:20 DEBUG : **REDACTED**: Uploading part 49/77 offset 3Gi/4.786Gi part size 64Mi
2023/08/04 18:17:24 DEBUG : **REDACTED**: Uploading part 50/77 offset 3.062Gi/4.786Gi part size 64Mi
2023/08/04 18:17:27 DEBUG : **REDACTED**: Uploading part 51/77 offset 3.125Gi/4.786Gi part size 64Mi
2023/08/04 18:17:34 DEBUG : **REDACTED**: Uploading part 52/77 offset 3.188Gi/4.786Gi part size 64Mi
2023/08/04 18:19:14 DEBUG : **REDACTED**: Uploading part 53/77 offset 3.250Gi/4.786Gi part size 64Mi
2023/08/04 18:19:15 DEBUG : **REDACTED**: Uploading part 54/77 offset 3.312Gi/4.786Gi part size 64Mi
2023/08/04 18:19:30 DEBUG : **REDACTED**: Uploading part 55/77 offset 3.375Gi/4.786Gi part size 64Mi
2023/08/04 18:19:33 DEBUG : **REDACTED**: Uploading part 56/77 offset 3.438Gi/4.786Gi part size 64Mi
2023/08/04 18:21:08 DEBUG : **REDACTED**: Uploading part 57/77 offset 3.500Gi/4.786Gi part size 64Mi
2023/08/04 18:21:11 DEBUG : **REDACTED**: Uploading part 58/77 offset 3.562Gi/4.786Gi part size 64Mi
2023/08/04 18:21:25 DEBUG : **REDACTED**: Uploading part 59/77 offset 3.625Gi/4.786Gi part size 64Mi
2023/08/04 18:21:30 DEBUG : **REDACTED**: Uploading part 60/77 offset 3.688Gi/4.786Gi part size 64Mi
2023/08/04 18:23:06 DEBUG : **REDACTED**: Uploading part 61/77 offset 3.750Gi/4.786Gi part size 64Mi
2023/08/04 18:23:11 DEBUG : **REDACTED**: Uploading part 62/77 offset 3.812Gi/4.786Gi part size 64Mi
2023/08/04 18:23:12 DEBUG : **REDACTED**: Uploading part 63/77 offset 3.875Gi/4.786Gi part size 64Mi
2023/08/04 18:23:27 DEBUG : **REDACTED**: Uploading part 64/77 offset 3.938Gi/4.786Gi part size 64Mi
2023/08/04 18:25:01 DEBUG : **REDACTED**: Uploading part 65/77 offset 4Gi/4.786Gi part size 64Mi
2023/08/04 18:25:07 DEBUG : **REDACTED**: Uploading part 66/77 offset 4.062Gi/4.786Gi part size 64Mi
2023/08/04 18:25:11 DEBUG : **REDACTED**: Uploading part 67/77 offset 4.125Gi/4.786Gi part size 64Mi
2023/08/04 18:25:26 DEBUG : **REDACTED**: Uploading part 68/77 offset 4.188Gi/4.786Gi part size 64Mi
2023/08/04 18:27:01 DEBUG : **REDACTED**: Uploading part 69/77 offset 4.250Gi/4.786Gi part size 64Mi
2023/08/04 18:27:02 DEBUG : **REDACTED**: Uploading part 70/77 offset 4.312Gi/4.786Gi part size 64Mi
2023/08/04 18:27:06 DEBUG : **REDACTED**: Uploading part 71/77 offset 4.375Gi/4.786Gi part size 64Mi
2023/08/04 18:27:06 DEBUG : box{EOkOO}: Loaded invalid token from config file - ignoring
2023/08/04 18:27:07 DEBUG : **REDACTED**: Uploading part 72/77 offset 4.438Gi/4.786Gi part size 64Mi
2023/08/04 18:27:07 DEBUG : box{EOkOO}: Loaded invalid token from config file - ignoring
2023/08/04 18:27:13 DEBUG : box root '**REDACTED**': Token expired - 2 uploads in progress - refreshing
2023/08/04 18:27:14 DEBUG : jwtutil: Response Body: {"access_token":"**REDACTED**","expires_in":3666,"restricted_to":[],"token_type":"bearer"}
2023/08/04 18:27:14 DEBUG : Saving config "token" in section "box" of the config file
2023/08/04 18:27:14 DEBUG : Keeping previous permissions for config file: -rw-r--r--
2023/08/04 18:27:14 DEBUG : box{EOkOO}: Saved new token in config file
2023/08/04 18:27:14 DEBUG : box root '**REDACTED**': Token refresh successful
2023/08/04 18:28:47 DEBUG : **REDACTED**: Cancelling multipart upload: multipart upload failed to upload part: Put "https://upload.box.com/api/2.0/files/upload_sessions/**REDACTED**": token expired and there's no refresh token - manually refresh with "rclone config reconnect box{EOkOO}:"
2023/08/04 18:28:47 DEBUG : box{EOkOO}: Loaded fresh token from config file
2023/08/04 18:28:48 ERROR : test.mkv: Failed to copy: multipart upload failed to upload part: Put "https://upload.box.com/api/2.0/files/upload_sessions/**REDACTED**": token expired and there's no refresh token - manually refresh with "rclone config reconnect box{EOkOO}:"
2023/08/04 18:28:48 ERROR : Fatal error received - not attempting retries
2023/08/04 18:28:48 INFO  : 
Transferred:   	    9.161 GiB / 9.161 GiB, 100%, 625.840 KiB/s, ETA 0s
Errors:                 1 (fatal error encountered)
Elapsed time:   1h12m34.1s

2023/08/04 18:28:48 DEBUG : 9 go routines active
2023/08/04 18:28:48 Failed to copy: multipart upload failed to upload part: Put "https://upload.box.com/api/2.0/files/upload_sessions/**REDACTED**": token expired and there's no refresh token - manually refresh with "rclone config reconnect box{EOkOO}:"

See this message and thread.

Using information provided by @vashp2029 we have updated rclone docs. You can see clientID part in the latest rclone beta box documentation

Referring to the box API authentication documentation we have 4 authentication methods

  1. Oauth2
  2. Oauth2 with JWT
  3. Client Credentials
  4. App Tokens

The documentation linked covers #1 using oauth2 to allow rclone to act as you and therefore you cannot limit access to files in your own account: rclone has all or nothing.

My setup is using #2 where rclone authenticates with box and has a service account hence the box_sub_type = enterprise. This allows me to control what rclone can see using permissions. No refresh token is supplied with the Oauth2 flow as I think it is expected the API wants you to do the whole auth flow from scratch to get a new token. Sample code for the Oauth2 JWT flow without the box SDK is here with documentation. This method is supported by rclone however does not seem to be working. In my debug log, the refresh does work at least once, it just doesn't happen twice in succession.

The app token #4 would have been the best as you can generate tokens that don't expire however they are only supported by the limited access app which has restricted endpoints i.e. no copying files server side etc.

The last one client credentials #3 is not supported by rclone.

I think you might be right that something is broken.

this PR had no chance to be properly tested it looks.

Shall I raise a git issue?

I think yes - the best way for somebody to look at the code. You collected enough evidence to point into some real issue.

Issue raised:

1 Like

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