claude-code - 💡(How to fix) Fix Onboarding flow ignores CLAUDE_CODE_OAUTH_TOKEN, blocks interactive CLI [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46259Fetched 2026-04-11 06:25:02
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
commented ×2labeled ×2

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().

Fix Action

Workaround

Manually add "hasCompletedOnboarding": true to ~/.claude.json.

Code Example

if (oauthEnabled) {
    steps.push({
      id: 'oauth',
      component: <SkippableStep skip={skipOAuth} onSkip={goToNextStep}>
          <ConsoleOAuthFlow onDone={goToNextStep} />
        </SkippableStep>
    });
}
RAW_BUFFERClick to expand / collapse

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-guide agent bug found in the same session)

🤖 Generated with Claude Code

Once again 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.

extent analysis

TL;DR

Modify the Onboarding.tsx file to check getAuthTokenSource().hasToken and skip the OAuth step when a valid token is provided via the CLAUDE_CODE_OAUTH_TOKEN environment variable.

Guidance

  • Check the getAuthTokenSource() function to see if it correctly returns a token when CLAUDE_CODE_OAUTH_TOKEN is set.
  • Modify the Onboarding.tsx file to include a conditional check for getAuthTokenSource().hasToken before including the OAuth step.
  • Verify that the skipOAuth variable is correctly set when a custom API key is approved or when a valid token is provided via environment variable.
  • Consider adding a check for hasCompletedOnboarding in the onboarding flow to prevent it from appearing on every launch.

Example

if (oauthEnabled && !getAuthTokenSource().hasToken) {
    steps.push({
      id: 'oauth',
      component: <SkippableStep skip={skipOAuth} onSkip={goToNextStep}>
          <ConsoleOAuthFlow onDone={goToNextStep} />
        </SkippableStep>
    });
}

Notes

The provided workaround of manually adding "hasCompletedOnboarding": true to ~/.claude.json may not be a permanent solution and may need to be reapplied after updates or changes to the system.

Recommendation

Apply the workaround by modifying the Onboarding.tsx file to check for a valid token via environment variable, as this addresses the root cause of the issue and provides a more robust solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING