diff --git a/internal/cli/login.go b/internal/cli/login.go index 818a9422f..45c3062ee 100644 --- a/internal/cli/login.go +++ b/internal/cli/login.go @@ -19,6 +19,20 @@ var ( Help: "Specifies tenant domain when authenticating via client credentials (client ID, client secret)", IsRequired: false, } + + loginClientID = Flag{ + Name: "Client ID", + LongForm: "client-id", + Help: "Client ID of the application.", + IsRequired: true, + } + + loginClientSecret = Flag{ + Name: "Client Secret", + LongForm: "client-secret", + Help: "Client Secret of the application.", + IsRequired: true, + } ) type LoginInputs struct { @@ -62,8 +76,8 @@ func loginCmd(cli *cli) *cobra.Command { } loginTenantDomain.RegisterString(cmd, &inputs.Domain, "") - tenantClientID.RegisterString(cmd, &inputs.ClientID, "") - tenantClientSecret.RegisterString(cmd, &inputs.ClientSecret, "") + loginClientID.RegisterString(cmd, &inputs.ClientID, "") + loginClientSecret.RegisterString(cmd, &inputs.ClientSecret, "") cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { _ = cmd.Flags().MarkHidden("tenant") @@ -183,11 +197,11 @@ func RunLoginAsMachine(ctx context.Context, inputs LoginInputs, cli *cli, cmd *c return err } - if err := tenantClientID.Ask(cmd, &inputs.ClientID, nil); err != nil { + if err := loginClientID.Ask(cmd, &inputs.ClientID, nil); err != nil { return err } - if err := tenantClientSecret.AskPassword(cmd, &inputs.ClientSecret, nil); err != nil { + if err := loginClientSecret.AskPassword(cmd, &inputs.ClientSecret, nil); err != nil { return err } diff --git a/internal/cli/tenants.go b/internal/cli/tenants.go index 405b80dc8..c11859adc 100644 --- a/internal/cli/tenants.go +++ b/internal/cli/tenants.go @@ -8,29 +8,6 @@ import ( "github.com/auth0/auth0-cli/internal/prompt" ) -var ( - tenantDomain = Argument{ - Name: "Tenant", - Help: "Tenant to select", - } - - tenantClientID = Flag{ - Name: "Client ID", - LongForm: "client-id", - ShortForm: "i", - Help: "Client ID of the application.", - IsRequired: true, - } - - tenantClientSecret = Flag{ - Name: "Client Secret", - LongForm: "client-secret", - ShortForm: "s", - Help: "Client Secret of the application.", - IsRequired: true, - } -) - func tenantsCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ Use: "tenants", @@ -126,6 +103,11 @@ func openTenantCmd(cli *cli) *cobra.Command { Domain string } + var tenantDomain = Argument{ + Name: "Tenant", + Help: "Tenant to select", + } + cmd := &cobra.Command{ Use: "open", Args: cobra.MaximumNArgs(1),