From 57aebbc1afd22a698eca9d384aee39478239c03f Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 7 Jan 2025 12:22:50 +0000 Subject: [PATCH] lib/oauthutil: don't require token to exist for client credentials flow Before this change when setting up client credentials flow manually, rclone would fail with this error message on first run despite the fact that no existing token is needed. empty token found - please run "rclone config reconnect remote:" This fixes the problem by ignoring token loading problems for client credentials flow. --- lib/oauthutil/oauthutil.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oauthutil/oauthutil.go b/lib/oauthutil/oauthutil.go index 323737bcf..a03fd592d 100644 --- a/lib/oauthutil/oauthutil.go +++ b/lib/oauthutil/oauthutil.go @@ -480,7 +480,7 @@ func OverrideCredentials(name string, m configmap.Mapper, origConfig *Config) (n func NewClientWithBaseClient(ctx context.Context, name string, m configmap.Mapper, config *Config, baseClient *http.Client) (*http.Client, *TokenSource, error) { config, _ = OverrideCredentials(name, m, config) token, err := GetToken(name, m) - if err != nil { + if err != nil && !config.ClientCredentialFlow { return nil, nil, err }