Skip to content

fix container-config auth mode for 1Password-sourced Anthropic secrets - #468

Open
erichanwang wants to merge 1 commit into
onecli:mainfrom
erichanwang:fix/container-config-oauth-token-env
Open

fix container-config auth mode for 1Password-sourced Anthropic secrets#468
erichanwang wants to merge 1 commit into
onecli:mainfrom
erichanwang:fix/container-config-oauth-token-env

Conversation

@erichanwang

Copy link
Copy Markdown

fixes #387

changes

  • buildOnePasswordMetadata (secret-service.ts) hardcoded authMode: "api-key" for every 1Password-sourced anthropic secret — the server never resolves the 1Password value, so it can't detect the mode from it the way it does for an inline value. container-config reads that stored authMode and always emitted ANTHROPIC_API_KEY, so OAuth token injection silently never fired for 1Password-sourced Anthropic OAuth tokens.
  • add an optional authMode field to createSecretSchema/updateSecretSchema, threaded through buildOnePasswordMetadata so the caller can say which mode a 1Password-sourced anthropic secret is
  • add an API Key / OAuth Token toggle in the secret dialog, shown once a 1Password field is picked for an anthropic secret, mirroring the existing OpenAI API Key/Codex toggle
  • OpenAI is left untouched: a 1Password-sourced OpenAI value is still always treated as a raw API key (Codex OAuth is only ever a directly-uploaded auth.json)

verification

  • pnpm --filter @onecli/api exec vitest run (all passing; pre-existing .prisma/client failure resolved after pnpm db:generate, unrelated to this change)
  • pnpm --filter @onecli/api exec tsc --noEmit -p .
  • pnpm --filter web exec tsc --noEmit -p .
  • pnpm --filter web exec eslint "src/app/(dashboard)/connections/_components/secret-dialog.tsx"
  • git diff --check
  • pnpm check (full monorepo lint/check-types/format, ran via pre-push hook)

buildOnePasswordMetadata hardcoded authMode: "api-key" for every
1Password-sourced anthropic/openai secret, since the server never sees
the resolved value and can't detect the mode from it. container-config
then always emitted ANTHROPIC_API_KEY instead of CLAUDE_CODE_OAUTH_TOKEN
for OAuth tokens stored in 1Password, so OAuth injection silently never
fired for that path.

Adds an optional authMode field the caller sets explicitly for a
1Password-sourced anthropic secret (the UI now shows an API Key/OAuth
Token toggle when a 1Password field is selected), and threads it
through to the stored metadata that container-config branches on.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019XrcMxXTRMo1C8t4AyUJor
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.

container-config returns ANTHROPIC_API_KEY=placeholder instead of CLAUDE_CODE_OAUTH_TOKEN=placeholder when OAuth token is configured

1 participant