ClaudeWrapper.Commands.Auth (ClaudeWrapper v0.4.0)

Copy Markdown View Source

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

Summary

Functions

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

Logout.

Set up an API token directly.

Check authentication status.

Types

auth_status()

@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()
}

Functions

login(config)

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

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

logout(config)

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

Logout.

setup_token(config, token)

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

Set up an API token directly.

status(config)

@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.