[BUG] OAuth login fails with status code 400 in VS Code and "Invalid code" in CLI on macOS

Status Open
Reported on v2.1.283
Maintainer reply None cached
Activity 0 comments · opened Sep 26, 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?

OAuth authentication fails in both the official Claude Code VS Code extension and Claude Code CLI on macOS.

In the VS Code extension, selecting "Claude.ai Subscription" immediately shows:

Request failed with status code 400

I also tested authentication using Claude Code CLI.

The CLI successfully generates the OAuth authorization URL and displays:

Paste code here if prompted >

I open the generated authorization URL in a browser, complete authentication, copy the full authorization code, and paste it back into the same CLI OAuth session.

Claude Code then returns:

OAuth error: Invalid code. Please make sure the full code was copied

I retried with newly generated OAuth sessions and fresh authorization codes, but the same error occurs.

I also checked for ANTHROPIC_ and CLAUDE_ environment variables using:

env | grep -E 'ANTHROPIC|CLAUDE'

No matching environment variables are set.

What Should Happen?

OAuth authentication should complete successfully after authorizing the Claude.ai account.

The VS Code extension should log in without returning HTTP 400, and the CLI should accept the authorization code generated for the same OAuth session.

Error Messages/Logs

Steps to Reproduce

  1. Install/open the official Claude Code extension in VS Code on macOS.
  2. Open Claude Code.
  3. Select "Claude.ai Subscription".
  4. Observe: "Request failed with status code 400".
  5. Open Terminal.
  6. Run claude.
  7. Start the Claude.ai OAuth login flow.
  8. Copy the OAuth URL generated by Claude Code.
  9. Open the URL in a browser and complete authorization.
  10. Copy the full authorization code.
  11. Paste the code into the same CLI session at "Paste code here if prompted >".
  12. Press Enter.
  13. Observe: "OAuth error: Invalid code. Please make sure the full code was copied".

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.283

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗