diff --git a/Makefile b/Makefile index d68f0c181..8c703574f 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ test-unit: ## Run unit tests test-integration: $(GO_BIN)/commander ## Run integration tests. To run a specific test pass the FILTER var. Usage: `make test-integration FILTER="attack protection"` ${call print, "Running integration tests"} @$(MAKE) install # ensure fresh install prior to running test - auth0 login --as-machine --domain ${AUTH0_CLI_CLIENT_DOMAIN} --client-id ${AUTH0_CLI_CLIENT_ID} --client-secret ${AUTH0_CLI_CLIENT_SECRET} && commander test ./test/integration/test-cases.yaml --filter "$(FILTER)"; \ + auth0 login --domain ${AUTH0_CLI_CLIENT_DOMAIN} --client-id ${AUTH0_CLI_CLIENT_ID} --client-secret ${AUTH0_CLI_CLIENT_SECRET} && commander test ./test/integration/test-cases.yaml --filter "$(FILTER)"; \ exit_code=$$?; \ bash ./test/integration/scripts/test-cleanup.sh; \ exit $$exit_code diff --git a/docs/auth0_login.md b/docs/auth0_login.md index a2a6d0d56..b8d1f46c8 100644 --- a/docs/auth0_login.md +++ b/docs/auth0_login.md @@ -18,15 +18,13 @@ auth0 login [flags] ``` auth0 login - auth0 login --as-machine - auth0 login --as-machine --domain --client-id --client-secret + auth0 login --domain --client-id --client-secret ``` ### Options ``` - --as-machine Initiates authentication as a machine via client credentials (client ID, client secret) -i, --client-id string Client ID of the application. -s, --client-secret string Client Secret of the application. --domain string Specifies tenant domain when authenticating via client credentials (client ID, client secret) diff --git a/internal/cli/login.go b/internal/cli/login.go index ca1f1cd27..59d7a4a2a 100644 --- a/internal/cli/login.go +++ b/internal/cli/login.go @@ -13,12 +13,6 @@ import ( ) var ( - loginAsMachine = Flag{ - Name: "Login as machine", - LongForm: "as-machine", - Help: "Initiates authentication as a machine via client credentials (client ID, client secret)", - IsRequired: false, - } loginTenantDomain = Flag{ Name: "Tenant Domain", LongForm: "domain", @@ -28,10 +22,9 @@ var ( ) type LoginInputs struct { - LoginAsMachine bool - Domain string - ClientID string - ClientSecret string + Domain string + ClientID string + ClientSecret string } func loginCmd(cli *cli) *cobra.Command { @@ -44,13 +37,12 @@ func loginCmd(cli *cli) *cobra.Command { Long: "Authenticates the Auth0 CLI either as a user using personal credentials or as a machine using client credentials (client ID/secret).", Example: ` auth0 login - auth0 login --as-machine - auth0 login --as-machine --domain --client-id --client-secret + auth0 login --domain --client-id --client-secret `, RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() - shouldLoginAsMachine := inputs.LoginAsMachine || inputs.ClientID != "" || inputs.ClientSecret != "" || inputs.Domain != "" + shouldLoginAsMachine := inputs.ClientID != "" || inputs.ClientSecret != "" || inputs.Domain != "" if shouldLoginAsMachine { if err := RunLoginAsMachine(ctx, inputs, cli, cmd); err != nil { @@ -69,7 +61,6 @@ func loginCmd(cli *cli) *cobra.Command { }, } - loginAsMachine.RegisterBool(cmd, &inputs.LoginAsMachine, false) loginTenantDomain.RegisterString(cmd, &inputs.Domain, "") tenantClientID.RegisterString(cmd, &inputs.ClientID, "") tenantClientSecret.RegisterString(cmd, &inputs.ClientSecret, "") diff --git a/test/integration/test-cases.yaml b/test/integration/test-cases.yaml index cca704b62..e0bd30e39 100644 --- a/test/integration/test-cases.yaml +++ b/test/integration/test-cases.yaml @@ -3,7 +3,7 @@ config: tests: login as machine: - command: auth0 logout $AUTH0_CLI_CLIENT_DOMAIN; auth0 login --as-machine --client-id $AUTH0_CLI_CLIENT_ID --client-secret $AUTH0_CLI_CLIENT_SECRET --domain $AUTH0_CLI_CLIENT_DOMAIN + command: auth0 logout $AUTH0_CLI_CLIENT_DOMAIN; auth0 login --client-id $AUTH0_CLI_CLIENT_ID --client-secret $AUTH0_CLI_CLIENT_SECRET --domain $AUTH0_CLI_CLIENT_DOMAIN stderr: "Successfully authenticated to" exit-code: 0