Skip to content

Commit

Permalink
Merge branch 'main' into cli-135
Browse files Browse the repository at this point in the history
  • Loading branch information
alejofernandez authored Apr 29, 2021
2 parents 415c92c + 781f245 commit 8b97b43
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions internal/cli/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ func RunLogin(ctx context.Context, cli *cli, expired bool) error {
if expired {
cli.renderer.Warnf("Please sign in to re-authorize the CLI.")
} else {
cli.renderer.Infof("✪ Welcome to the Auth0 CLI 🎊.")
cli.renderer.Infof("To set it up, you will need to sign in to your Auth0 account and authorize the CLI to access the API.")
cli.renderer.Infof("If you don't have an account, please go to https://auth0.com/signup, otherwise continue in the browser.\n\n")
fmt.Print("✪ Welcome to the Auth0 CLI 🎊\n\n")
fmt.Print("If you don't have an account, please go to https://auth0.com/signup\n\n")
}

a := &auth.Authenticator{}
Expand All @@ -46,21 +45,26 @@ func RunLogin(ctx context.Context, cli *cli, expired bool) error {
return fmt.Errorf("could not start the authentication process: %w.", err)
}

cli.renderer.Infof("Your pairing code is: %s\n", ansi.Bold(state.UserCode))
cli.renderer.Infof("This pairing code verifies your authentication with Auth0.")
cli.renderer.Infof("Press Enter to open the browser (^C to quit)")
fmt.Printf("Your Device Confirmation code is: %s\n\n", ansi.Bold(state.UserCode))
cli.renderer.Infof("%s to open the browser to log in or %s to quit...", ansi.Green("Press Enter"), ansi.Red("^C"))
fmt.Scanln()

err = open.URL(state.VerificationURI)

if err != nil {
cli.renderer.Warnf("Couldn't open the URL, please do it manually: %s.", state.VerificationURI)
}

res, err := a.Wait(ctx, state)
var res auth.Result
err = ansi.Spinner("Waiting for login to complete in browser", func() error {
res, err = a.Wait(ctx, state)
return err
})

if err != nil {
return fmt.Errorf("login error: %w", err)
}

fmt.Print("\n")
cli.renderer.Infof("Successfully logged in.")
cli.renderer.Infof("Tenant: %s\n", res.Domain)

Expand Down

0 comments on commit 8b97b43

Please sign in to comment.