MCPcopy Create free account
hub / github.com/auth0/auth0-cli / logoutCmd

Function logoutCmd

internal/cli/logout.go:11–45  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

9)
10
11func logoutCmd(cli *cli) *cobra.Command {
12 cmd := &cobra.Command{
13 Use: "logout",
14 Args: cobra.MaximumNArgs(1),
15 Short: "Log out of a tenant's session",
16 Long: "Log out of a tenant's session.",
17 Example: ` auth0 logout
18 auth0 logout <tenant>
19 auth0 logout "example.us.auth0.com"`,
20 RunE: func(cmd *cobra.Command, args []string) error {
21 selectedTenant, err := selectValidTenantFromConfig(cli, cmd, args)
22 if err != nil {
23 return err
24 }
25
26 if err := cli.Config.RemoveTenant(selectedTenant); err != nil {
27 return fmt.Errorf("failed to log out from the tenant %q: %w", selectedTenant, err)
28 }
29
30 if err := keyring.DeleteSecretsForTenant(selectedTenant); err != nil {
31 return fmt.Errorf("failed to delete tenant secrets: %w", err)
32 }
33
34 cli.renderer.Infof("Successfully logged out from tenant: %s", selectedTenant)
35 return nil
36 },
37 }
38
39 cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
40 _ = cmd.Flags().MarkHidden("tenant")
41 cmd.Parent().HelpFunc()(cmd, args)
42 })
43
44 return cmd
45}

Callers 1

addSubCommandsFunction · 0.85

Calls 5

DeleteSecretsForTenantFunction · 0.92
RemoveTenantMethod · 0.80
ErrorfMethod · 0.80
InfofMethod · 0.80

Tested by

no test coverage detected