Bug: Claude Code VS Code extension stuck in login loop / API key not recognized

Resolved 💬 3 comments Opened Jan 1, 2026 by lzno37 Closed Jan 5, 2026

Preflight Checklist

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

What's Wrong?

I’m unable to successfully authenticate Claude Code in VS Code.

When logging in via Anthropic Console, the browser shows:
https://console.anthropic.com/oauth/code/success?app=claude-code

Then it syncs with you account and after saying "Success" nothing changes on Claude Console inside VS Code

However, the VS Code extension never updates its state and continues to show:

Invalid API key · Please run /login

Running /login again just repeats the same flow, resulting in an infinite login loop.

What I tried

Login via Anthropic Console (OAuth flow completes with “success”)
Manual authorization code (copying code= from localhost callback when available)
Setting ANTHROPIC_API_KEY as an environment variable
Restarting VS Code
Removing extension data / reinstalling the extension
Verifying that my Anthropic account has active API credits

What Should Happen?

After a successful OAuth login, Claude Code should:

  • Recognise the authenticated Anthropic session or
  • Accept the configured API key
  • Transition into a usable authenticated state inside VS Code

Error Messages/Logs

❌ Actual Behavior

VS Code extension remains unauthenticated

Always shows “Invalid API key · Please run /login”

OAuth success page does not propagate back to the extension

User is stuck in a permanent login loop

Steps to Reproduce

Steps to Reproduce

Install the Claude Code VS Code extension on Windows

Open VS Code

Start Claude Code and run /login

Choose Anthropic Console as the login method

Complete authentication in the browser

Browser shows oauth/code/success

Return to VS Code

Result:
Claude Code still shows Invalid API key · Please run /login and re-running /login repeats the same flow indefinitely.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Latest

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

No error logs are shown in the extension UI.
The OAuth flow completes successfully in the browser, but the VS Code extension never transitions to an authenticated state.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗