We have a remote repo on OneDrive through a university account. So it's business type.
The problem is that seemingly every now and then (almost everyday) rclone fails to access the repo, and gives the following error:
"error":"invalid_grant","error_description":"AADSTS50173:
The provided grant has expired due to it being revoked, a fresh auth token is needed.
Then when we remove the remote and initiate a new one, it works again until soon the token gets revoked.
Last time I checked the config file, the "expiry" time (that comes after "refresh_token") was just in about an hour after I created a new remote.
What is your rclone version (output from rclone version)
rclone v1.50.2
os/arch: linux/amd64
go version: go1.13.4
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Ubuntu 18.04.4 LTS 64 bit
Which cloud storage system are you using? (eg Google Drive)
OneDrive
The command you were trying to run (eg rclone copy /tmp remote:tmp)
A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)
Yes. According to the config file, there is an "access_token," and there is also a "refresh_token". And the "token_type" is "Bearer," if that's important.
{"error":"invalid_grant","error_description":"AADSTS50173: The provided grant has expired due to it being revoked, a fresh auth token is needed. The user might have changed or reset their password. The grant was issued on '2020-04-08T04:35:38.4010000Z' and the TokensValidFrom date (before which tokens are not valid) for this user is '2020-04-08T21:34:16.0000000Z'.\r\nTrace ID: b46c38c2-af54-4ddf-af32-576886c51500\r\nCorrelation ID: e6102e3d-421a-4d45-b454-9324181ecf6c\r\nTimestamp: 2020-04-11 18:17:40Z","error_codes":[50173],"timestamp":"2020-04-11 18:17:40Z","trace_id":"b46c38c2-af54-4ddf-af32-576886c51500","correlation_id":"e6102e3d-421a-4d45-b454-9324181ecf6c","error_uri":"https://login.microsoftonline.com/error?code=50173"}
There is quite a lot of extra info there for humans to read...
AADSTS50173: The provided grant has expired due to it being revoked, a fresh auth token is needed. The user might have changed or reset their password. The grant was issued on '2020-04-08T04:35:38.4010000Z' and the TokensValidFrom date (before which tokens are not valid) for this user is '2020-04-08T21:34:16.0000000Z'. https://login.microsoftonline.com/error?code=50173
There is also this on the link
Expected part of the token lifecycle - either an admin or a user revoked the tokens for this user, causing subsequent token refreshes to fail and require re-authentication. Have the user sign-in again.
I presume you didn't change your password. I wonder if your admin only lets the tokens last for a short period of time? It might be worth sending your admin that link and asking them about it.
I can't find an official explanation anywhere but my refresh token suddenly didn't work.
Does onedrive refresh token expire under some conditions?
Although I noticed that every time I use refresh token to get an access token, a new refresh token was returned by onedrive. Should I use the new one or just keep using the original one since there is no difference?
Hope someone can help me. shareitvidmate