# `ClaudeWrapper.Commands.Auth`
[🔗](https://github.com/genagent/claude_wrapper_ex/blob/main/lib/claude_wrapper/commands/auth.ex#L1)

Authentication commands -- login, logout, status, token setup.

# `auth_status`

```elixir
@type auth_status() :: %{
  logged_in: boolean(),
  auth_method: String.t() | nil,
  api_provider: String.t() | nil,
  email: String.t() | nil,
  org_id: String.t() | nil,
  org_name: String.t() | nil,
  subscription_type: String.t() | nil,
  extra: map()
}
```

# `login_mode`

```elixir
@type login_mode() :: :claudeai | :console
```

Which billing path the CLI should authenticate against.

Maps to `--claudeai` (Claude subscription) or `--console` (Anthropic
Console / API usage billing) on `claude auth login`. The CLI defaults
to `:claudeai` when neither flag is passed; setting `:console` is the
only way Console-billed teams reach their account.

# `login`

```elixir
@spec login(
  ClaudeWrapper.Config.t(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}
```

Login via browser. This is interactive -- the CLI will open a browser.

## Options

  * `:email` -- pre-populate the email address on the login page
    (`--email <email>`).
  * `:mode` -- pin the billing path. `:claudeai` (the CLI default,
    maps to `--claudeai`) or `:console` (maps to `--console`,
    required for teams on Anthropic Console billing).
  * `:force_sso` -- when `true`, force the SSO login flow (`--sso`).

## Examples

    # Default subscription login
    {:ok, _} = ClaudeWrapper.Commands.Auth.login(config)

    # Console-billed login, pre-filling the email
    {:ok, _} =
      ClaudeWrapper.Commands.Auth.login(config,
        mode: :console,
        email: "ops@example.com"
      )

# `logout`

```elixir
@spec logout(ClaudeWrapper.Config.t()) :: {:ok, String.t()} | {:error, term()}
```

Logout.

# `setup_token`

```elixir
@spec setup_token(ClaudeWrapper.Config.t(), String.t()) ::
  {:ok, String.t()} | {:error, term()}
```

Set up an API token directly.

# `status`

```elixir
@spec status(ClaudeWrapper.Config.t()) :: {:ok, auth_status()} | {:error, term()}
```

Check authentication status.

Returns parsed status if the CLI supports JSON output, raw text otherwise.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
