> ## Documentation Index
> Fetch the complete documentation index at: https://docs.joystream.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> jstm init, login, logout, and whoami — every sign-in mode and what each stores.

## `jstm init`

Scaffold `config.toml` in your config directory with a freshly generated encryption key.

```bash theme={null}
jstm init
jstm init --force    # overwrite an existing config
```

<ParamField path="--force, -f">
  Overwrite an existing `config.toml`. Without it, `init` leaves an existing config alone.
</ParamField>

## `jstm login`

Sign in. There are three modes.

<Tabs>
  <Tab title="Browser (default)">
    ```bash theme={null}
    jstm login
    ```

    Opens your browser to a verification page showing a user code, then polls until you approve. This is the same device flow used by `gh` and similar tools.

    If you can't open a browser — a remote shell, a container — add `--no-browser` and the CLI prints the URL and code for you to open elsewhere.

    ```bash theme={null}
    jstm login --no-browser
    ```
  </Tab>

  <Tab title="Email code">
    ```bash theme={null}
    jstm login --email dana@acme.com
    ```

    Sends a one-time code to that address and verifies it in the terminal. No browser involved.

    To skip the interactive prompt — in a script, or when you already have the code:

    ```bash theme={null}
    jstm login --email dana@acme.com --otp 481920
    ```
  </Tab>

  <Tab title="Password">
    ```bash theme={null}
    jstm login --email dana@acme.com --password
    ```

    <Warning>
      Password login is deprecated and prints a deprecation warning. Use the browser or email-code flow.
    </Warning>
  </Tab>
</Tabs>

| Option             | Description                                         |
| ------------------ | --------------------------------------------------- |
| `--email`, `-e`    | Email address. Sends a login code to it             |
| `--password`, `-p` | Password. Deprecated                                |
| `--otp`            | Login code, skipping the interactive prompt         |
| `--no-browser`     | Print the URL and code instead of opening a browser |
| `--json`           | Emit the result as JSON                             |

On success, your session is written to `session.json` with `0600` permissions. See [Configuration](/cli/configuration) for where that file lives.

<Info>
  In CI, set `JOYSTREAM_TOKEN` instead of logging in. It takes precedence over the session file.
</Info>

## `jstm logout`

Clear the stored session.

```bash theme={null}
jstm logout
jstm logout --json
```

## `jstm whoami`

Show the current user and workspace context. This is the fastest way to confirm you're signed in and pointed at the right workspace.

```bash theme={null}
jstm whoami
jstm whoami --json
```

If it reports a session problem, run `jstm login` again. If it reports a connection problem, check `JOYSTREAM_API_URL` — the error names the URL it tried.

## `jstm commands`

Print every command and subcommand as a table. Useful when you want the whole surface at once.

```bash theme={null}
jstm commands
```

This command has no `--json`.
