Skip to content

Onboarding flow ignores CLAUDE_CODE_OAUTH_TOKEN, blocks interactive CLI #46259

Description

@ojura

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

🤖 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions