Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

oauth: Allow auth_url and token_url to be set in the config file

Nick Craig-Wood52e1bfae2a8b
diff --git a/fs/config.go b/fs/config.go
index 4bc804b1c..993dacae1 100644
--- a/fs/config.go
+++ b/fs/config.go
@@ -44,6 +44,12 @@ const (
// ConfigClientSecret is the config key used to store the client secret
ConfigClientSecret = "client_secret"
+ // ConfigAuthURL is the config key used to store the auth server endpoint
+ ConfigAuthURL = "auth_url"
+
+ // ConfigTokenURL is the config key used to store the token server endpoint
+ ConfigTokenURL = "token_url"
+
// ConfigAutomatic indicates that we want non-interactive configuration
ConfigAutomatic = "config_automatic"
)
diff --git a/oauthutil/oauthutil.go b/oauthutil/oauthutil.go
index a5da620b5..6f8948a68 100644
--- a/oauthutil/oauthutil.go
+++ b/oauthutil/oauthutil.go
@@ -209,6 +209,16 @@ func overrideCredentials(name string, origConfig *oauth2.Config) (config *oauth2
config.ClientSecret = ClientSecret
changed = true
}
+ AuthURL := fs.ConfigFileGet(name, fs.ConfigAuthURL)
+ if AuthURL != "" {
+ config.Endpoint.AuthURL = AuthURL
+ changed = true
+ }
+ TokenURL := fs.ConfigFileGet(name, fs.ConfigTokenURL)
+ if TokenURL != "" {
+ config.Endpoint.TokenURL = TokenURL
+ changed = true
+ }
return config, changed
}