Skip to content

Commit 5b9e2f6

Browse files
TerryHowerobertsirc
authored andcommitted
fix: user username password for login
Signed-off-by: Terry Howe <[email protected]> (cherry picked from commit 2c55a4e)
1 parent 2782412 commit 5b9e2f6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/registry/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,16 +289,16 @@ func (c *Client) Login(host string, options ...LoginOption) error {
289289
return err
290290
}
291291
reg.PlainHTTP = c.plainHTTP
292+
cred := auth.Credential{Username: c.username, Password: c.password}
293+
c.authorizer.ForceAttemptOAuth2 = true
292294
reg.Client = c.authorizer
293295

294296
ctx := context.Background()
295-
cred, err := c.authorizer.Credential(ctx, host)
296-
if err != nil {
297-
return fmt.Errorf("fetching credentials for %q: %w", host, err)
298-
}
299-
300297
if err := reg.Ping(ctx); err != nil {
301-
return fmt.Errorf("authenticating to %q: %w", host, err)
298+
c.authorizer.ForceAttemptOAuth2 = false
299+
if err := reg.Ping(ctx); err != nil {
300+
return fmt.Errorf("authenticating to %q: %w", host, err)
301+
}
302302
}
303303

304304
// The credentialsStore loader does not handle empty files. So, there is a workaround.

0 commit comments

Comments
 (0)