Skip to content

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

@lzno37

Description

@lzno37

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?

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions