[Bug] CLAUDE_CODE_OAUTH_TOKEN ignored on first run due to onboarding gate
Bug Description
Title: CLAUDE_CODE_OAUTH_TOKEN ignored on first run — onboarding forces theme picker + login instead of using the token
Environment:
- Claude Code v2.1.198
- Windows (corporate VDI), PowerShell
- Auth: pre-generated OAuth token from claude setup-token (scope: user:inference), delivered via CLAUDE_CODE_OAUTH_TOKEN
Summary:
On a fresh machine with a valid CLAUDE_CODE_OAUTH_TOKEN set, launching claude always shows the theme-selection screen and then drops into the interactive login flow — it never uses the provided token to authenticate. The token is effectively ignored because startup gates on onboarding completion (hasCompletedOnboarding in ~/.claude.json) rather than on available credentials. This blocks the exact use case setup-token exists for: authenticating a machine that can't do interactive browser login (locked-down VDI).
Steps to reproduce:
1. On a machine that can log in: claude setup-token, copy the token.
2. On a fresh machine (no prior ~/.claude.json): set CLAUDE_CODE_OAUTH_TOKEN to that token (verified present in the launching shell, correct sk-ant-oat01- prefix, no whitespace).
3. Confirm no competing credentials: [REDACTED], ANTHROPIC_AUTH_TOKEN, CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX all unset; settings.json has no apiKeyHelper/forceLoginMethod.
4. Run claude from that same shell.
Expected: Claude Code uses CLAUDE_CODE_OAUTH_TOKEN and starts authenticated, skipping the interactive login.
Actual: Shows theme selection, then the login screen — the token is never used. Only after manually writing {"hasCompletedOnboarding": true} into ~/.claude.json does the token get used.
Suggested fix: When a valid CLAUDE_CODE_OAUTH_TOKEN (or ANTHROPIC_API_KEY) is present, treat auth as satisfied and either skip the onboarding/login gate or auto-set hasCompletedOnboarding. Requiring a manual ~/.claude.json edit defeats the purpose of a headless token.
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 2.1.198
- Feedback ID: 73288213-708f-4cd6-b479-09a9fe64959f
Errors
[]This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗