"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
oauthlib: add method to set a token as expired
Ovidiu Victor Tatar53400d7edcfe
diff --git a/lib/oauthutil/oauthutil.go b/lib/oauthutil/oauthutil.goindex 53a08900c..2033ac5f5 100644--- a/lib/oauthutil/oauthutil.go+++ b/lib/oauthutil/oauthutil.go@@ -269,6 +269,23 @@ func (ts *TokenSource) Invalidate() {ts.mu.Unlock()}+// Expire marks the token as expired+//+// This also marks the token in the config file as expired, if it is the same one+func (ts *TokenSource) Expire() error {+ ts.mu.Lock()+ defer ts.mu.Unlock()+ ts.token.Expiry = time.Now().Add(time.Hour * (-1)) // expire token+ t, err := GetToken(ts.name, ts.m)+ if err != nil {+ return err+ }+ if t.AccessToken == ts.token.AccessToken {+ err = PutToken(ts.name, ts.m, ts.token, false)+ }+ return err+}+// timeToExpiry returns how long until the token expires//// Call with the lock helddiff --git a/lib/oauthutil/renew.go b/lib/oauthutil/renew.goindex 1fb96e771..29786cf69 100644--- a/lib/oauthutil/renew.go+++ b/lib/oauthutil/renew.go@@ -67,3 +67,8 @@ func (r *Renew) Stop() {func (r *Renew) Invalidate() {r.ts.Invalidate()}++// Expire expires the token source+func (r *Renew) Expire() error {+ return r.ts.Expire()+}