Skip to content

Commit

Permalink
feat: add headless flag (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlabs authored Jan 13, 2025
1 parent 9a378a3 commit 21b0160
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cmd/go-aws-sso/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ func main() {
Hidden: false,
Required: false,
},
&cli.BoolFlag{
Name: "headless",
Usage: "show the verification URL without opening it in a browser",
Value: false,
Hidden: false,
Required: false,
},
}

initialFlags = append(configFlags, initialFlags...)
Expand Down
7 changes: 6 additions & 1 deletion pkg/sso/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ func startDeviceAuthorization(oidc ssooidciface.SSOOIDCAPI, rco *ssooidc.Registe
sdao, err := oidc.StartDeviceAuthorization(&ssooidc.StartDeviceAuthorizationInput{ClientId: rco.ClientId, ClientSecret: rco.ClientSecret, StartUrl: &startUrl})
check(err)
zap.S().Warnf("Please verify your client request: %s", *sdao.VerificationUriComplete)
openUrlInBrowser(*sdao.VerificationUriComplete)

// open it in a browser unless in headless mode
if !strings.Contains(strings.Join(os.Args, ","), "--headless") {
openUrlInBrowser(*sdao.VerificationUriComplete)
}

return *sdao
}

Expand Down

0 comments on commit 21b0160

Please sign in to comment.