MCPcopy Create free account
hub / github.com/jetify-com/devbox / loginCmd

Function loginCmd

internal/boxcli/auth.go:35–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33}
34
35func loginCmd() *cobra.Command {
36 cmd := &cobra.Command{
37 Use: "login",
38 Short: "Login to devbox",
39 Args: cobra.ExactArgs(0),
40 RunE: func(cmd *cobra.Command, args []string) error {
41 c, err := identity.AuthClient(identity.AuthRedirectDefault)
42 if err != nil {
43 return err
44 }
45 t, err := c.LoginFlow()
46 if err != nil {
47 return err
48 }
49 // TODO: all uses of IDClaims() are broken when using a static
50 // non-expiring token (i.e. API_TOKEN)
51 fmt.Fprintf(cmd.ErrOrStderr(), "Logged in as: %s\n", t.IDClaims().Email)
52 return nil
53 },
54 }
55
56 return cmd
57}
58
59func logoutCmd() *cobra.Command {
60 cmd := &cobra.Command{

Callers 2

authCmdFunction · 0.85
whoAmICmdFunction · 0.85

Calls 1

AuthClientFunction · 0.92

Tested by

no test coverage detected