Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onedrive token revoked within 90 days #4512

Closed
landall opened this issue Aug 14, 2020 · 9 comments
Closed

Onedrive token revoked within 90 days #4512

landall opened this issue Aug 14, 2020 · 9 comments

Comments

@landall
Copy link
Contributor

landall commented Aug 14, 2020

I have met a thread in the forum about onedrive token revoking.
https://forum.rclone.org/t/onedrive-token-keeps-getting-revoked/15479/9

The refresh token of onedrive dies in about 90 days. So if someone do not use an onedrive token for more than 90 days, he may get an error of invalid_grant.

It is very annoying to delete this account and reauthorize it in rclone.

Maybe we should add some way to refresh all of the onedrive tokens regularly.

@darthShadow
Copy link
Member

What do you think should be done if rclone is not using the remote for more than 90 days?

@ncw
Copy link
Member

ncw commented Aug 16, 2020

It is very annoying to delete this account and reauthorize it in rclone.

You don't have to do that. Just run

rclone config reconnect remote:

@landall
Copy link
Contributor Author

landall commented Aug 16, 2020

What do you think should be done if rclone is not using the remote for more than 90 days?

I think it should be a document modification.
Renewing the tokens is not the duty of rclone.

Not many users know this thing. They think rclone should renew the token when they use it next time.

maybe we need a hint about how to setup a schedule task to avoid the expiry of Onedrive tokens.

@ncw
Copy link
Member

ncw commented Aug 19, 2020

The refresh token of onedrive dies in about 90 days. So if someone do not use an onedrive token for more than 90 days, he may get an error of invalid_grant.

Where is that documented? I don't see this for either my onedrive personal or onedrive business account?

Every time rclone does a token refresh it should get a new refresh token. If you don't use the backend at all for 90 days it might expire I suppose - is that what you are seeing?

@landall
Copy link
Contributor Author

landall commented Aug 19, 2020

The refresh token of onedrive dies in about 90 days. So if someone do not use an onedrive token for more than 90 days, he may get an error of invalid_grant.

Where is that documented? I don't see this for either my onedrive personal or onedrive business account?

Every time rclone does a token refresh it should get a new refresh token. If you don't use the backend at all for 90 days it might expire I suppose - is that what you are seeing?

https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes

Just search “Refresh Token Max Inactive Time”

It is not part of onedrive but active directory.
And it is widely reported that the refresh token will be expired.
for example:
https://www.microsoftpartnercommunity.com/t5/Multi-Factor-Authentication-MFA/OAuth-Refresh-token-has-expired-after-90-days/td-p/9200
https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/8339
https://stackoverflow.com/questions/44101568/microsoft-graph-api-refresh-token-expired

@ncw
Copy link
Member

ncw commented Aug 20, 2020

I'm not sure what to suggest other than adding some stuff to the docs?

If you don't run rclone for 90 days then yes, the refresh token will time out. However nearly all the cloud providers are like that.

@landall
Copy link
Contributor Author

landall commented Aug 21, 2020

I think a suggestion in the docs and the view of adding a new Onedrive account is enough?
I will create a scheduled task to run rclone and use these tokens every month but I think it is not the duty of rclone.

@landall
Copy link
Contributor Author

landall commented Aug 21, 2020

It is counterintuitive that a refresh token is not immortal.

@ncw ncw closed this as completed in 1abc252 Aug 21, 2020
@ncw
Copy link
Member

ncw commented Aug 21, 2020

OK I've put a note in the docs about this and how to refresh the token.

Thanks for bringing this up.

@ncw ncw added doc fix and removed enhancement labels Aug 21, 2020
@ncw ncw added this to the v1.53 milestone Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants