From 053b323f0af6d497f7822709bee7d965949123bb Mon Sep 17 00:00:00 2001 From: Savil Srivastava <676452+savil@users.noreply.github.com> Date: Tue, 30 Jan 2024 13:02:26 -0800 Subject: [PATCH] [auth] add --show-tokens to devbox auth whoami --- internal/boxcli/auth.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/boxcli/auth.go b/internal/boxcli/auth.go index 8fc7f725046..19f34b8868f 100644 --- a/internal/boxcli/auth.go +++ b/internal/boxcli/auth.go @@ -75,7 +75,12 @@ func logoutCmd() *cobra.Command { return cmd } +type whoAmICmdFlags struct { + showTokens bool +} + func whoAmICmd() *cobra.Command { + flags := &whoAmICmdFlags{} cmd := &cobra.Command{ Use: "whoami", Short: "Show the current user", @@ -90,10 +95,17 @@ func whoAmICmd() *cobra.Command { return err } return box.UninitializedSecrets(cmd.Context()). - WhoAmI(cmd.Context(), cmd.OutOrStdout(), false) + WhoAmI(cmd.Context(), cmd.OutOrStdout(), flags.showTokens) }, } + cmd.Flags().BoolVar( + &flags.showTokens, + "show-tokens", + false, + "Show the access, id, and refresh tokens", + ) + return cmd }