Help with Refresh Token Expiry!

What is the problem you are having with rclone?

Hi guys!
So sorry, I would rate myself as low effort here on troubleshooting as I am already flooded with many tasks. This is one of my project which the past developer has used rclone to upload files to sharepoint.. I got an error that says refresh token has expired. I know it is possible to request for another using rclone config

My quesiton is,how will this impact all the other sync that are using rclone? Rclone has this token expiry if the refresh_token isnt used for more than 90 days, anyway to disable this?

What is your rclone version (output from rclone version)

1.52.3

Which OS you are using and how many bits (eg Windows 7, 64 bit)

windows server 2016 64 bit

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

onedrive/sharepoint

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

rclone.exe copy "local_path" "remote:local_path" --config Local_config_path  --ignore-size --ignore-checksum --log-file "local_log_path" -v

The rclone config contents with secrets removed.

[example]
type = onedrive
client_id  = 
client_secret =
Token=  
drive_id=
drive_type=documentLibrary

A log from the command with the -vv flag

2020/08/26 12:42:11 Failed to create file system for "remote_path:\\local_path": failed to get root: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2020-05-06T06:56:21.7400146Z and was inactive for 90.00:00:00.\r\n 

Unfortunately, rclone can't do anything about this since the expiry is from Microsoft's side. You can get a new token by running: rclone config reconnect example: Relevant issue:

1 Like

Thanks for your prompt reply darth!
Another question, I tried running rclone config, it says I do not have existing remote..
Is it possible cause these are set up by another user so I dont have visibility to them?
Or can I just rclone config reconnect <remote_name> even though the remotes are not visible ?

You need to specify this for every command if the config file is in a separate location.

1 Like

thanks Anagh! lemme give it a try tomorrow :slight_smile:

Hi Anagh!
Thank you. Able to go to next steps! but it is asking me for more details on oauth2 and which drive to use, drive id etc..

I chose drive ID, pasted my drive ID and was greeted with this error.

HTTP error 503 (503 Service Unavailable) returned body: "{\r\n "error": {\r\n "code": "serviceNotAvailable",\r\n "message": "Service unavailable",\r\n "innerError": {\r\n "date": "2020-08-27T07:40:05",\r\n

also, I am thinking is there a way to refresh all token in a config file at one go ?
I have a lot of remotes in one config file and it wouldnt be feasible to reconnect all one by one. Appreciate your advise .

Thank you

Can you specify the exact command that you ran and the debug logs for that?

You can probably write a script to iterate over the output of rclone listremotes and call config reconnect on each of them.

Hi Anagh,

I did a rclone config reconnect

then i proceed till the below, with error:

Log in and authorize rclone for access
Waiting for code...
Got code
Choose a number from below, or type in an existing value
1 / OneDrive Personal or Business
\ "onedrive"
2 / Root Sharepoint site
\ "sharepoint"
3 / Type in driveID
\ "driveid"
4 / Type in SiteID
\ "siteid"
5 / Search a Sharepoint site
\ "search"

I selected driveid and pasted my drive id.
Your choice> 3
Paste your Drive ID here>

...2020/08/27 15:38:25 Failed to query root for drive HTTP error 503 (503 Service Unavailable) returned body: "{\r\n "error": {\r\n "code": "serviceNotAvailable",\r\n "message": "Service unavailable",\r\n "innerError": {\r\n "date": "2020-08-27T07:40:05",\r\n

You can probably write a script to iterate over the output of rclone listremotes and call config reconnect on each of them.

but for this I will still need to individually provide the drive ID, cause the rclone config reconnect command requires so..

Please add the requested debug logs too.

Hi darth,

I realised after running reconnect, as long as I have signed in to Oauth,
my refresh token will be updated. So now I can use it already!

One question tho, I am going to script it, how can I stop the config reconnect command so it doesnt proceed with next steps after the Oauth has been done? I am going to do it for all the remotes in the config file, so I believe I have to break the command after Oauth has been successfully authenticated.

I am not sure about that. Perhaps someone else can provide some suggestion for that.

Do you mean you don't want it to ask for which team drive to use? There isn't a way of doing that at the moment but you could echo the keypresses into the command

echo -e "y\ny\nn\n" | rclone config reconnect drive:

Hi Nick,

Thank you for the reply.
Anyway if you would know, will it work if I use the same refresh token for all my remotes? they are all for onedrive, but different drive ID.

Tried this, seems like it doesnt work for windows command prompt.'

Blockquote
echo -e "y\ny\nn\n" | rclone config reconnect drive:

Got the message below:

Already have a token - refresh?
y) Yes (default)
n) No
y/n> y/n> 2020/09/01 16:37:43 Failed to read line: EOF

I think so. Some backends don't like it but I think you are OK with onedrive.

No that was for unix command prompt.

I'm not a WIndows expert, but I found this with a bit of searching

perhaps we could add a flag like --auto-reconnect

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