---
# Generated by kapten-docs from the CLI's command tree. DO NOT EDIT.
title: "kapten auth"
description: "Log in, check who commands run as, and switch between saved logins (contexts)."
sidebar:
  label: "auth"
---

`kapten login`, `kapten whoami` and `kapten logout` are shortcuts for the `kapten auth` commands of the same name. See [Authentication](/cli/authentication) for how logins, contexts and server mode work. Every command takes the [global flags](/cli/reference#global-flags).

## kapten auth list

List saved contexts.

```bash
kapten auth list [flags]
```

| Flag | Description |
| --- | --- |
| `--json` | Output JSON |
| `-o, --output string` | Output format: table or json |

## kapten auth login

Log in with the device authorization grant: open the page shown, on this machine or any other, and approve the code. Works over SSH. Credentials are saved in the OS keychain, or in an owner-only file when no keychain is available.

With KAPTEN_CLIENT_ID and KAPTEN_CLIENT_SECRET set, commands authenticate as that OAuth application instead and no login is needed.

```bash
kapten auth login [flags]
```

| Flag | Description |
| --- | --- |
| `--api-url string` | Engine API URL (default $KAPTEN_API_URL, else https://api.kapten.io) |
| `--issuer-url string` | Auth service URL (default $KAPTEN_ISSUER_URL, else https://auth.kapten.io) |
| `--name string` | Name for a new context (default: the organization's slug) |
| `--no-browser` | Do not open a browser |

Examples:

```bash
kapten login
kapten login --no-browser
kapten login --name staging --issuer-url https://auth-staging.kapten.io --api-url https://api-staging.kapten.io
```

## kapten auth logout

Remove saved credentials.

```bash
kapten auth logout [context] [flags]
```

| Flag | Description |
| --- | --- |
| `--all` | Log out of every context |

## kapten auth use

Select the active context.

```bash
kapten auth use <context>
```

## kapten auth whoami

Show who commands run as.

```bash
kapten auth whoami [flags]
```

| Flag | Description |
| --- | --- |
| `--json` | Output JSON |
