LAUDE_CODE_OAUTH_TOKEN env var ignored in browser-based Codespace — localhost OAuth callback fails (v2.1.186)

Resolved 💬 2 comments Opened Jun 23, 2026 by brutster1398 Closed Jun 27, 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?

In a browser-based GitHub Codespace (.github.dev), Claude Code v2.1.186 ignores the CLAUDE_CODE_OAUTH_TOKEN environment variable and always shows the login menu. Selecting option 1 (Claude account) triggers a localhost OAuth callback that fails with ERR_CONNECTION_REFUSED because localhost is not accessible in a browser Codespace. The env var workaround that previously worked no longer functions in this version.

What Should Happen?

CLAUDE_CODE_OAUTH_TOKEN should be honored on startup, bypassing the OAuth flow entirely. This is the only viable auth path in browser-based Codespaces where localhost callbacks are impossible.

<img width="1364" height="872" alt="Image" src="https://github.com/user-attachments/assets/b188cbda-87b5-4f12-b923-1d132f59f289" />

Error Messages/Logs

Steps to Reproduce

  1. Open a browser-based GitHub Codespace (.github.dev — not VS Code desktop)
  2. Install Claude Code: npm install -g @anthropic-ai/claude-code
  3. Export token: export CLAUDE_CODE_OAUTH_TOKEN="<token from claude setup-token on local machine>"
  4. Run: claude
  5. CC ignores the env var and displays the login menu anyway
  6. Select option 1 (Claude account with subscription)
  7. Browser opens localhost callback URL — fails with ERR_CONNECTION_REFUSED

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.186

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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