Unable to fetch zoho tokens (cloning from zoho to s3)

What is the problem you are having with rclone?

Unable to clone from Zoho to s3. Here is our workflow:

  • (One time only) get Zoho tokens using rclone config tool

Then once every 15 minutes:

  • Fetch rclone configuration from our s3

  • Launch rclone

  • Upload rclone configuration to our s3 (tokens may have changed)

We should not reach Zoho limiation as stated in the documention we are limited to 10 tokens for 10 minutes.

This stopped working arround last week but has been working well for years.

What I tried:

  • Generate new fresh token with rclone config tool

  • Creating a new oauth app on zoho side and getting new tokens

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

We use a custom docker image based on rclone/rclone:1.65, the image only add aws cli from alpine packages


/app # rclone version

rclone v1.65.2

- os/version: alpine 3.19.0 (64 bit)

- os/kernel: 5.10.0-21-amd64 (x86_64)

- os/type: linux

- os/arch: amd64

- go/version: go1.21.6

- go/linking: static

- go/tags: none

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

Zoho

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


rclone sync $SOURCE_NAME:$SOURCE_PATH $DESTINATION_NAME:$BUCKET_NAME/$DESTINATION_PATH --filter-from filters --config rclone.conf

The full script is


#!/usr/bin/env sh

set -e

# Fetch rclone configuration from encrypted bucket

aws s3 cp s3://$BUCKET_NAME/configuration/rclone.conf .

# Synchronize from zoho to s3

rclone sync $SOURCE_NAME:$SOURCE_PATH $DESTINATION_NAME:$BUCKET_NAME/$DESTINATION_PATH --filter-from filters --config rclone.conf

# Configuration may have changed after running, mostly because of

# token refreshment

aws s3 cp rclone.conf s3://$BUCKET_NAME/configuration/

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.


[zoho]

type = zoho

region = eu

token = {"access_token":XXX,"token_type":"Zoho-oauthtoken","refresh_token":XXX,"expiry":"2024-02-16T13:14:00.521231+01:00"}

root_folder_id = XXX

[s3]

type = s3

provider = AWS

env_auth = true

access_key_id = XXX

secret_access_key = XXX

region = eu-west-3

location_constraint = eu-west-3

acl = private

bucket_acl = private

A log from the command that you were trying to run with the -vv flag


2024/02/23 11:11:15 DEBUG : rclone: Version "v1.65.2" starting with parameters ["rclone" "sync" "zoho:OUT/" "s3:[REDACTED]/files/" "--filter-from" "filters" "--config" "rclone.conf" "-vv" "--log-file=full_logs.txt"]

2024/02/23 11:11:15 DEBUG : Creating backend with remote "zoho:OUT/"

2024/02/23 11:11:15 DEBUG : Using config file from "/app/rclone.conf"

2024/02/23 11:11:15 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:20 DEBUG : zoho: Token refresh failed try 1/5: oauth2: "invalid_code"

2024/02/23 11:11:21 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:21 DEBUG : zoho: Token refresh failed try 2/5: oauth2: "invalid_code"

2024/02/23 11:11:22 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:22 DEBUG : zoho: Token refresh failed try 3/5: oauth2: "invalid_code"

2024/02/23 11:11:23 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:23 DEBUG : zoho: Token refresh failed try 4/5: oauth2: "invalid_code"

2024/02/23 11:11:24 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:24 DEBUG : zoho: Token refresh failed try 5/5: oauth2: "invalid_code"

2024/02/23 11:11:25 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:25 DEBUG : zoho: Token refresh failed try 1/5: oauth2: "invalid_code"

2024/02/23 11:11:26 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:26 DEBUG : zoho: Token refresh failed try 2/5: oauth2: "invalid_code"

2024/02/23 11:11:27 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:27 DEBUG : zoho: Token refresh failed try 3/5: oauth2: "invalid_code"

2024/02/23 11:11:28 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:28 DEBUG : zoho: Token refresh failed try 4/5: oauth2: "invalid_code"

2024/02/23 11:11:29 DEBUG : zoho: Loaded invalid token from config file - ignoring

2024/02/23 11:11:29 DEBUG : zoho: Token refresh failed try 5/5: oauth2: "invalid_code"

2024/02/23 11:11:30 Failed to create file system for "zoho:OUT/": couldn't list files: Get "https://workdrive.zoho.eu/api/v1/files/[REDACTED]/files?page%5Blimit%5D=10&page%5Boffset%5D=0": couldn't fetch token: oauth2: "invalid_code"

Thanks for your time working on this awesome tool, I hope we can find what's wrong here.

welcome to the forum,

just a guess, maybe you recently updated rclone and that caused the issue?

what did zoho tech support tell you about it.
maybe zoho made a change and have not updated docs yet?

Hey, thank you !

In fact no, we used fixed version (1.55) as docker image base. I just updated before posting here to make sure newer versions don't fix our bug (reading changelogs i did not see any impactful changes for our use case to zoho backend).

I still have to get in touch with zoho support but it's not that easy because we are not direct client (our client has the zoho's client account), so i wanted to make sure we cannot fix this without reaching them.

If you think i must contact them before, tell me and i will do my best.

have you seen?
https://forum.rclone.org/t/rclone-invokes-more-number-of-workdrives-files-listing-api-calls-which-exceeds-the-throttling-limit/43037

Yes I saw this thread while searching but tbh i'm not sure it's related because in my understanding it's more about query throttling then tokens. They might be linked but since the guy from Zoho never answered i'm unsure of the status of this.

yes, i agree. just want to be sure you read it; to get an idea of the difficulty rclone has in supporting zoho.

and for deeper look, might add --dump flags

Yes indeed I understand this is hard work and I thank every open-source contributors for that ! Do you have any example about using the --dump flag ? It's does not seems to work, I'm getting the help when I append it at the end of my command. The doc seems confusing to me.

the docs are at https://rclone.org/docs/#dump-flag-flag-flag

as the issue is with oauth2, i am not 100% sure which info needs to be dumped.
i would start with --dump=headers

Oh right, thank you ! So I have done it, I'm not sure if i can paste it since there some UID from set-cookies headers, i'm unsure how sensitive those are ?

But I find something in the log which bother me (it was already here before the dump flag): 2024/02/24 18:57:19 DEBUG : zoho: Loaded invalid token from config file - ignoring doesn't that mean that my config's token is being ignored and it query the api with the default client we can find here and lead to throttling ? I may be absolutely wrong since i'm not at all familiar with Go nor the Rclone source.

Ok, after a new try today it works as expected. To be honest i can't say if this was a bug on Zoho side or if being tired I mixed things up. I'm sorry for the time you took to look at it.

Thank you for your help, your work on a such awesome project and your advises on debugging, keep up the good work !

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