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
@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.
Functions
@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-- whentrue, 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"
)
@spec logout(ClaudeWrapper.Config.t()) :: {:ok, String.t()} | {:error, term()}
Logout.
@spec setup_token(ClaudeWrapper.Config.t(), String.t()) :: {:ok, String.t()} | {:error, term()}
Set up an API token directly.
@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.