mirror of
https://github.com/helm/helm.git
synced 2026-04-09 19:06:24 -04:00
Merge pull request #30979 from TerryHowe/oras-v2-login-for-v4
fix: OAuth username password login for v4
This commit is contained in:
commit
ba0fbdeb57
1 changed files with 6 additions and 6 deletions
|
|
@ -230,16 +230,16 @@ func (c *Client) Login(host string, options ...LoginOption) error {
|
|||
return err
|
||||
}
|
||||
reg.PlainHTTP = c.plainHTTP
|
||||
cred := auth.Credential{Username: c.username, Password: c.password}
|
||||
c.authorizer.ForceAttemptOAuth2 = true
|
||||
reg.Client = c.authorizer
|
||||
|
||||
ctx := context.Background()
|
||||
cred, err := c.authorizer.Credential(ctx, host)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fetching credentials for %q: %w", host, err)
|
||||
}
|
||||
|
||||
if err := reg.Ping(ctx); err != nil {
|
||||
return fmt.Errorf("authenticating to %q: %w", host, err)
|
||||
c.authorizer.ForceAttemptOAuth2 = false
|
||||
if err := reg.Ping(ctx); err != nil {
|
||||
return fmt.Errorf("authenticating to %q: %w", host, err)
|
||||
}
|
||||
}
|
||||
|
||||
key := credentials.ServerAddressFromRegistry(host)
|
||||
|
|
|
|||
Loading…
Reference in a new issue