8000 update device login message by rustyjux · Pull Request #125 · bcgov/gwa-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

update device login message #125

New issue

Have a question about this project? Sign up for a free GitHub account t 8000 o 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

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions cmd/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ func TestDeviceLoginSuccess(t *testing.T) {
mainCmd.Execute()
})
assert.Contains(t, out, fmt.Sprintf(`
To complete the login process, please follow these steps:
1. Open this URL in your web browser: %s
2. Enter this code when prompted: ABCD-EFGH
3. Complete the IDIR authentication process in your browser
4. Return to this terminal window after successful authentication

Please sign in at %s
Input the following code ABCD-EFGH

Waiting for authentication handshake...`, verificationUrl))
Waiting for you to complete the login process...`, verificationUrl))
}

func TestClientCredentialLogin(t *testing.T) {
Expand Down
10 changes: 6 additions & 4 deletions pkg/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,12 @@ func deviceLogin(wellKnownConfig WellKnownConfig, clientId string, timeout time.
return err
}

urlLine := fmt.Sprintf("\n\nPlease sign in at %s", response.Data.VerificationUri)
fmt.Println(urlLine)
fmt.Println("Input the following code", boldText.Render(response.Data.UserCode))
fmt.Print("\nWaiting for authentication handshake...")
fmt.Println("\nTo complete the login process, please follow these steps:")
fmt.Printf("1. Open this URL in your web browser: %s\n", boldText.Render(response.Data.VerificationUri))
fmt.Printf("2. Enter this code when prompted: %s\n", boldText.Render(response.Data.UserCode))
fmt.Println("3. Complete the IDIR authentication process in your browser")
fmt.Println("4. Return to this terminal window after successful authentication")
fmt.Println("\nWaiting for you to complete the login process...")

for i := 0; i < 60; i++ {
err := pollAuthStatus(wellKnownConfig.TokenEndpoint, clientId, response.Data.DeviceCode)
Expand Down
Loading
0