# Authentication

Most CLI commands need a Jitsu host and an API key. Either pass them on every
invocation (`-h`, `-k`) or save them once with `login`.

## `login`

Saves credentials so subsequent commands don't need `-h` / `-k`.

```bash
jitsu-cli login                                    # interactive
jitsu-cli login -h https://use.jitsu.com -k keyId:secret
jitsu-cli login -f                                 # overwrite an existing session
```

Generate API keys in the Jitsu UI on the
[user settings page](https://use.jitsu.com/user). The key has the format
`{keyId}:{keySecret}` — the secret is shown once at creation, copy it then.

## `logout`

```bash
jitsu-cli logout
jitsu-cli logout -f       # do not ask for confirmation
```

## `whoami`

Verifies the saved (or supplied) credentials and prints the user info.

```bash
jitsu-cli whoami
jitsu-cli whoami -k keyId:secret
```

## Default workspace

Most `config` commands take `-w <workspace>`. To avoid passing it every time,
save a default:

```bash
jitsu-cli set-default-workspace my-workspace-slug
jitsu-cli unset-default-workspace
```

When set, any `config` command without `-w` uses this workspace. Per-command
`-w` still wins.