Skip to content

feat: box Claude auth via subscription OAuth token (setup-token)#176

Open
NagariaHussain wants to merge 1 commit into
developfrom
feat/box-claude-oauth-token
Open

feat: box Claude auth via subscription OAuth token (setup-token)#176
NagariaHussain wants to merge 1 commit into
developfrom
feat/box-claude-oauth-token

Conversation

@NagariaHussain

Copy link
Copy Markdown
Contributor

Lets agent boxes authenticate Claude via a Claude subscription instead of an Anthropic API key — unblocks running the agent when API access isn't available (the whole v2 test-server validation ran on subscription creds).

What

  • New Claude Code OAuth Token (Password) field on Hive Settings.
  • build_boot_env forwards it to boxes as CLAUDE_CODE_OAUTH_TOKEN, only when anthropic_api_key is empty (so the two auth modes never conflict).

Why no box/golden change is needed

  • devbox-init.sh writes MMDS env generically ((.env) | to_entries | map("export "+.key…)), so a new boot_env key flows into the box shell automatically.
  • When ANTHROPIC_API_KEY is empty, claude falls back to CLAUDE_CODE_OAUTH_TOKEN.

Usage

  1. claude setup-token locally → long-lived subscription token.
  2. Paste into Hive Settings → Claude Code OAuth Token, save.
  3. Assign a task → boxes auth hands-off. Switch to the API key later by filling anthropic_api_key and clearing this field.

Validation

  • hive_settings.json valid; service.py compiles; migrate clean on pms.localhost — field present as Password. Auth branch: API-key-set → forwards ANTHROPIC_API_KEY only; API-key-empty → forwards CLAUDE_CODE_OAUTH_TOKEN only.

Deploys via Frappe Cloud on merge (adds the field on migrate).

🤖 Generated with Claude Code

Adds a "Claude Code OAuth Token" (Password) field to Hive Settings and forwards it
to boxes as CLAUDE_CODE_OAUTH_TOKEN in build_boot_env — an alternative to
ANTHROPIC_API_KEY for when API access isn't available. Generate it with
`claude setup-token` (uses a Claude subscription, not API billing).

The box needs no change: devbox-init exports any boot_env key into the shell, and
claude falls back to the OAuth token when ANTHROPIC_API_KEY is empty. The token is
forwarded only when no API key is set, so the two auth modes never conflict — flip
to the API key later by filling anthropic_api_key and clearing this.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011C9jzHhfxDqtU13uWtazZm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant