CodexWrapper.Commands.Auth (CodexWrapper v0.8.0)

Copy Markdown View Source

Authentication commands -- login, logout, status.

Wraps codex login, codex logout, and codex login status.

These commands now use the config's runner instead of System.cmd. With the default Port runner, execution uses /bin/sh, stdin from /dev/null, and a SIGINT/TERM/KILL watchdog. A missing binary returns {:error, {:exit, 127, output}} instead of raising. Under Forcola, when neither config :timeout nor runner option :timeout_ms is set, the wall bound is the snapshotted :forcola_default_timeout_ms (300,000 ms unless configured), after which the command is cancelled and returns {:error, {:timeout, milliseconds}}. Set an explicit config :timeout long enough for interactive login or device authorization under Forcola. The Port runner has no whole-run bound unless :timeout is set; it does not provide interactive stdin.

Summary

Functions

Login to Codex.

Logout from Codex.

Check login status.

Functions

login(config, opts \\ [])

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

Login to Codex.

Options

  • :with_api_key - Use API key authentication (boolean)
  • :with_access_token - Use access token authentication (boolean)
  • :device_auth - Use device authorization flow (boolean)

logout(config)

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

Logout from Codex.

status(config)

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

Check login status.