Skip to content

Commit

Permalink
Replaced flag name to 'use-auth-code'
Browse files Browse the repository at this point in the history
  • Loading branch information
tirthct committed Jan 15, 2024
1 parent 1576f84 commit 56bf58c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/ocm/login/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var args struct {
password string
insecure bool
persistent bool
oauthLogin bool
useAuthCode bool
}

var Cmd = &cobra.Command{
Expand Down Expand Up @@ -147,12 +147,12 @@ func init() {
"persistently, in clear text, which is potentially unsafe.",
)
flags.BoolVar(
&args.oauthLogin,
"oauth-login",
&args.useAuthCode,
"use-auth-code",
false,
"Enables login using OAuth2, Redirects user to Red Hat SSO.",
)
flags.MarkHidden("oauth-login")
flags.MarkHidden("use-auth-code")
}

func run(cmd *cobra.Command, argv []string) error {
Expand All @@ -163,13 +163,14 @@ func run(cmd *cobra.Command, argv []string) error {
return fmt.Errorf("Option '--url' is mandatory")
}

if args.oauthLogin {
if args.useAuthCode {
fmt.Println("You will now be redirected to Red Hat SSO login")
token, err := authentication.VerifyLogin(oauthClientID)
if err != nil {
return err
}
args.token = token
fmt.Println("Token received successfully")
}

// Check that we have some kind of credentials:
Expand Down

0 comments on commit 56bf58c

Please sign in to comment.