1
0
mirror of https://github.com/smallstep/cli.git synced 2025-08-09 03:22:43 +03:00

Add STEP_OPEN_BROWSER env var to skip opening a browser and just output the authURL.

This commit is contained in:
Joe Doss
2025-02-11 16:25:39 -06:00
committed by Herman Slatman
parent f5a0bca360
commit c8872948a4

View File

@@ -784,6 +784,9 @@ func (o *oauth) DoLoopbackAuthorization() (*token, error) {
return nil, err
}
skipBrowser := os.Getenv("STEP_OPEN_BROWSER") == "false"
if !skipBrowser {
if err := exec.OpenInBrowser(authURL, o.browser); err != nil {
fmt.Fprintln(os.Stderr, "Cannot open a web browser on your platform.")
fmt.Fprintln(os.Stderr)
@@ -797,6 +800,9 @@ func (o *oauth) DoLoopbackAuthorization() (*token, error) {
fmt.Fprintln(os.Stderr, authURL)
fmt.Fprintln(os.Stderr)
}
} else {
fmt.Fprintln(os.Stderr, authURL)
}
// Wait for response and return the token
select {