claude-code - 💡(How to fix) Fix [BUG] Claude Code VS Code extension completes browser OAuth successfully but never receives the token, causing an infinite login loop

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…

The Claude Code VS Code extension completes browser OAuth successfully but never receives the token, causing an infinite login loop. The extension also does not recognize /status, /doctor, or /logout commands despite CLI being v2.1.114.

Error Message

Error Messages/Logs

Root Cause

The Claude Code VS Code extension completes browser OAuth successfully but never receives the token, causing an infinite login loop. The extension also does not recognize /status, /doctor, or /logout commands despite CLI being v2.1.114.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Summary

The Claude Code VS Code extension completes browser OAuth successfully but never receives the token, causing an infinite login loop. The extension also does not recognize /status, /doctor, or /logout commands despite CLI being v2.1.114.

Environment

  • OS: macOS (MacBook Pro, zsh shell)
  • VS Code extension: Claude Code for VS Code v2.1.114 (by Anthropic, Auto Update enabled)
  • Claude Code CLI: v2.1.114, installed at ~/.local/bin/claude via curl -fsSL https://claude.ai/install.sh | sh
  • Subscription: Claude Team (SchoolStatus organization)
  • Shell profile: ~/.local/bin added to PATH via ~/.zshrc
  • VS Code launch method: Launched from terminal via code command to ensure correct PATH inheritance

Steps to Reproduce

  1. Open Claude Code panel in VS Code
  2. Click "Claude.ai Subscription"
  3. Browser opens, select organization (SchoolStatus), click Authorize
  4. Browser shows "Build something great — You're all set up for Claude Code"
  5. VS Code immediately re-prompts for login — token is never received

Additional Symptoms

  • Extension does not recognize /status, /doctor, or /logout — all return "no matching commands" before submitting
  • Extension shows "Invalid API key · Fix external API key" in chat
  • Extension appears locked to Claude Haiku 4.5 and won't allow model change
  • CLI works correctly in Mac Terminal: shows "Sonnet 4.6 · Claude Team · SchoolStatus"
  • which claude correctly returns ~/.local/bin/claude
  • ANTHROPIC_API_KEY environment variable is NOT set

Additional Context

  • Originally set up VS Code and Claude Code using Docker and pulled configuration from a git repository — this may mean the extension has a Docker/git-sourced internal Claude Code that differs from the native CLI installation
  • A previously stored invalid API key (provided by a colleague, since revoked) was found in VS Code history at ~/Library/Application Support/Code/User/History/47c70924 and deleted
  • Reinstalled Claude Code CLI from scratch today using the native installer
  • PATH confirmed correct: echo $PATH | tr ':' '\n' | grep local/bin shows /Users/Joy/.local/bin

Expected Behavior

Browser OAuth should complete and pass the token back to VS Code, logging the extension in with the Team subscription.

Actual Behavior

Browser OAuth completes ("Build something great" page) but VS Code never receives the token and immediately re-prompts for login.

What Should Happen?

Browser OAuth should complete and pass the token back to VS Code, logging the extension in with the Team subscription.

Error Messages/Logs

Steps to Reproduce

  1. Open Claude Code panel in VS Code
  2. Click "Claude.ai Subscription"
  3. Browser opens, select organization (SchoolStatus), click Authorize
  4. Browser shows "Build something great — You're all set up for Claude Code"
  5. VS Code immediately re-prompts for login — token is never received

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.114

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

The issue might be resolved by ensuring the VS Code extension is using the correct CLI installation and configuration, potentially by reinstalling the extension or checking for any conflicting configurations.

Guidance

  • Verify that the ANTHROPIC_API_KEY environment variable is set correctly in the VS Code environment, as it is not set according to the provided information.
  • Check for any conflicting configurations or cached data in the VS Code extension, considering the previous use of Docker and a git repository for setup.
  • Reinstall the Claude Code extension in VS Code to ensure it is using the correct native CLI installation and configuration.
  • Test the CLI commands (/status, /doctor, /logout) directly in the VS Code terminal to see if they work as expected, which could indicate an issue with the extension's integration.

Example

No specific code example is provided due to the lack of direct code references in the issue.

Notes

The issue seems to be related to the interaction between the VS Code extension and the native CLI installation, potentially complicated by the initial setup using Docker and a git repository. Ensuring consistent configuration and environment variables across both the CLI and the VS Code extension is crucial.

Recommendation

Apply a workaround by reinstalling the Claude Code extension and verifying the environment variables and configurations are correctly set, as this approach addresses the potential inconsistencies between the CLI and the extension without requiring an upgrade to a potentially non-existent fixed version.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Claude Code VS Code extension completes browser OAuth successfully but never receives the token, causing an infinite login loop