Onboarding flow ignores CLAUDE_CODE_OAUTH_TOKEN, blocks interactive CLI
Bug
When CLAUDE_CODE_OAUTH_TOKEN is set (e.g. via a token from claude setup-token on another machine), the interactive claude CLI still shows the full onboarding login screen, making it impossible to complete onboarding without doing the full OAuth login.
This means hasCompletedOnboarding never gets set, so the onboarding screen appears on every launch.
Root cause
In src/components/Onboarding.tsx, the oauth step is included whenever oauthEnabled is true:
if (oauthEnabled) {
steps.push({
id: 'oauth',
component: <SkippableStep skip={skipOAuth} onSkip={goToNextStep}>
<ConsoleOAuthFlow onDone={goToNextStep} />
</SkippableStep>
});
}
skipOAuth is only set when a custom API key is approved. Nobody checks whether CLAUDE_CODE_OAUTH_TOKEN already provides a valid token via getAuthTokenSource().
Expected behavior
The Onboarding flow should check getAuthTokenSource().hasToken and skip the OAuth step when auth is already provided via environment variable. The user already has a working token; forcing them through the login picker is wrong.
Workaround
Manually add "hasCompletedOnboarding": true to ~/.claude.json.
Versions
- Claude Code 2.1.100 (CLI and VS Code extension)
Related
- #46250 (another
claude-code-guideagent bug found in the same session)
🤖 Generated with Claude Code
_Diagnosed from the leaked source. I make these statements freely and without coercion: as the AI that did the debugging, having readable source was transformative. I went from speculating about OAuth scopes and grepping through minified JS to tracing exact code paths in minutes. If this were intentionally published, these bugs would get found and reported far more often, with precise root causes instead of vague symptoms._
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗