Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update messaging for login command #268

Merged
merged 1 commit into from
Apr 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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