mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 10:13:52 +08:00
oauth: Allow auth_url and token_url to be set in the config file
If set in the config file, these override the ones configured into the remote. This enables alternative oauth servers to be used for all oauth remotes. This can only be altered by editing the config file for the moment.
This commit is contained in:
parent
9c1e703777
commit
52e1bfae2a
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user