# kindgi auth

> Manage local auth: logins (the API's URL and token, without a name or as Kindgi login profiles), and the runtime image's registry

## `kindgi auth`

**Synopsis**

```sh signature
kindgi auth <command>
```

Manage local auth: logins (the API's URL and token, without a name or as Kindgi login profiles), and the runtime image's registry.

**Commands**

| Command                                                                                             | Description                                                                                                                                      |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`kindgi auth login`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth-login)       | Persist an API URL + key to \~/.kindgi/config.json: the login without a name, or with --profile a Kindgi login profile's.                        |
| [`kindgi auth logout`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth-logout)     | Remove a login from \~/.kindgi/config.json: with --profile that Kindgi login profile's, else the one without a name.                             |
| [`kindgi auth list`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth-list)         | List the logins \~/.kindgi/config.json holds: the one without a name and each Kindgi login profile, with its address and whether it can be used. |
| [`kindgi auth whoami`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth-whoami)     | Verify the configured token by hitting the API.                                                                                                  |
| [`kindgi auth registry`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth-registry) | Log Docker in to the runtime image's registry (on registry.kindgi.com, with your license key), then check it can pull the image kindgi dev runs. |

**See also**

- [Deploy your agent to Kindgi Cloud](https://docs.kindgi.com/v0.7.0/hosted/deploy-your-agent.md)
- [Install](https://docs.kindgi.com/v0.7.0/start/install.md)

### `kindgi auth login`

**Synopsis**

```sh signature
kindgi auth login [--profile=<name>] [--hosted | --url=<url>] [--token-stdin | --token=<token>] [--force]
```

Persist an API URL + key to \~/.kindgi/config.json: the login without a name, or with --profile a Kindgi login profile's. --hosted saves Kindgi Cloud's address. Given no key, it asks for one, hidden, when stdin is a terminal. Another address's login there is kept unless --force.

**Options**

| Option          | Default | Description                                                                                                                                                                             |
| --------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--force`       | off     | Replace the login \~/.kindgi/config.json holds for another address (with --profile, that profile's): its API key is no longer stored. By default login refuses.                         |
| `--token-stdin` | off     | Read the API key from stdin, all of it (one trailing newline is dropped), so it lands in no shell history or `ps`: `printf '%s' "$KEY" \| kindgi auth login --url <url> --token-stdin`. |

Every command also takes the [global flags](https://docs.kindgi.com/v0.7.0/reference/cli.md#global-flags).

**Examples**

Save the API URL, and the API token exported as `KINDGI_API_TOKEN`, to \~/.kindgi/config.json.

```sh
kindgi auth login --url=https://kindgi.acme.example
```

From [Deploy your agent to Kindgi Cloud](https://docs.kindgi.com/v0.7.0/hosted/deploy-your-agent.md):

```sh
pnpm exec kindgi auth login --url=https://platform.kindgi.com
```

**See also**

- [Deploy your agent to Kindgi Cloud](https://docs.kindgi.com/v0.7.0/hosted/deploy-your-agent.md)
- [`kindgi auth`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth)

### `kindgi auth logout`

**Synopsis**

```sh signature
kindgi auth logout [--profile=<name>]
```

Remove a login from \~/.kindgi/config.json: with --profile that Kindgi login profile's, else the one without a name. Its API key is no longer stored.

**Options**

Every command also takes the [global flags](https://docs.kindgi.com/v0.7.0/reference/cli.md#global-flags).

**Examples**

Remove the login without a name from \~/.kindgi/config.json.

```sh
kindgi auth logout
```

Remove one Kindgi login profile's login.

```sh
kindgi auth logout --profile=acme-prod
```

**See also**

- [Deploy your agent to Kindgi Cloud](https://docs.kindgi.com/v0.7.0/hosted/deploy-your-agent.md)
- [Install](https://docs.kindgi.com/v0.7.0/start/install.md)
- [`kindgi auth`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth)

### `kindgi auth list`

**Synopsis**

```sh signature
kindgi auth list
```

List the logins \~/.kindgi/config.json holds: the one without a name and each Kindgi login profile, with its address and whether it can be used. Never a key.

**Options**

Every command also takes the [global flags](https://docs.kindgi.com/v0.7.0/reference/cli.md#global-flags).

**Examples**

The logins \~/.kindgi/config.json holds, each with its address and whether it can be used, never a key.

```sh
kindgi auth list --table
```

**See also**

- [Deploy your agent to Kindgi Cloud](https://docs.kindgi.com/v0.7.0/hosted/deploy-your-agent.md)
- [Install](https://docs.kindgi.com/v0.7.0/start/install.md)
- [`kindgi auth`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth)

### `kindgi auth whoami`

**Synopsis**

```sh signature
kindgi auth whoami
```

Verify the configured token by hitting the API.

**Options**

Every command also takes the [global flags](https://docs.kindgi.com/v0.7.0/reference/cli.md#global-flags).

**Examples**

Check that the saved token works against the API.

```sh
kindgi auth whoami
```

From [Deploy your agent to Kindgi Cloud](https://docs.kindgi.com/v0.7.0/hosted/deploy-your-agent.md):

```sh
pnpm exec kindgi auth whoami --hosted
pnpm exec kindgi auth whoami --profile cloud
```

**See also**

- [Deploy your agent to Kindgi Cloud](https://docs.kindgi.com/v0.7.0/hosted/deploy-your-agent.md)
- [`kindgi auth`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth)

### `kindgi auth registry`

**Synopsis**

```sh signature
kindgi auth registry [--key-from <store> | --password-stdin] [--username <name>] [--check] [--registry <host>]
```

Log Docker in to the runtime image's registry (on registry.kindgi.com, with your license key), then check it can pull the image kindgi dev runs.

**Options**

| Option               | Default                                                                                 | Description                                                                                                                                            |
| -------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--check`            | off                                                                                     | Only check that Docker can pull the image, without logging in.                                                                                         |
| `--key-from <value>` | none                                                                                    | Read the license key from where it's kept, as kindgi license renew does: file:…, env-file:…#NAME, gcp:…, azure:…, aws:…. For registry.kindgi.com only. |
| `--password-stdin`   | off                                                                                     | Read the license key (on another registry, the token) from stdin instead of prompting for it.                                                          |
| `--registry <value>` | `registry.kindgi.com`, the runtime image's registry                                     | The registry to log in to, such as a mirror; the check then looks for the image there. Default: the runtime image's registry (`registry.kindgi.com`).  |
| `--username <value>` | `kindgi` on `registry.kindgi.com`; required on another registry (except with `--check`) | Your username on another registry, which goes with that registry's own token. Not needed on registry.kindgi.com, which takes your license key.         |

Every command also takes the [global flags](https://docs.kindgi.com/v0.7.0/reference/cli.md#global-flags).

**Examples**

Log Docker in to registry.kindgi.com with your license key, then check the pull; the key is prompted for.

```sh
kindgi auth registry
```

Log in in a script, reading the license key from stdin.

```sh
kindgi auth registry --password-stdin < kindgi-license-key.txt
```

Log in to registry.kindgi.com with the license key a deployment already keeps, so it never passes through your shell.

```sh
kindgi auth registry --key-from env-file:kindgi.env#KINDGI_LICENSE_KEY
```

Check that Docker can already pull the image, without logging in.

```sh
kindgi auth registry --check
```

Log in to a mirror of the image instead, with that registry's own username and token; the check then looks for the image there.

```sh
kindgi auth registry --registry=registry.acme.example --username=acme-ci --password-stdin < mirror-token.txt
```

From [Install](https://docs.kindgi.com/v0.7.0/start/install.md):

```sh
npx --yes @kindgi/cli@0.7 auth registry
```

**See also**

- [Install](https://docs.kindgi.com/v0.7.0/start/install.md)
- [`kindgi auth`](https://docs.kindgi.com/v0.7.0/reference/cli/auth.md#kindgi-auth)
