fix(claude-code): add oauthToken config for subscription SDK auth #12
Reference in New Issue
Block a user
Delete Branch "fix/claude-code-oauth-token"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
claude loginalone does not authorize SDK / non-interactive(
claude -p) usage. Anthropic gates that behind a separate long-livedtoken minted by
claude setup-token. Without it, subscription usershit
billing_errorfrom the SDK even though interactive Claude Codeworks fine.
Changes:
provider exports it as CLAUDE_CODE_OAUTH_TOKEN before invoking the
SDK, which makes the SDK bill against the user's Pro/Max
subscription instead of API credits.
are present, oauthToken takes precedence.
claude setup-tokenso the fix is obvious from the error alone.the
claude setup-tokenstep explicitly.the smoke test actually works for subscribers.