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.
This commit is contained in:
Nick Craig-Wood 2025-01-07 12:22:50 +00:00
parent 5f70918e2c
commit bfb7b88371

View File

@ -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
}