[BUG] Claude Code OAuth authentication fails in proxy environment (Remote Development)

Resolved 💬 6 comments Opened Nov 12, 2025 by harusakura924 Closed Dec 30, 2025

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?

  1. OAuth code submission appears successful: Login successful
  2. Tokens are saved to secure storage: Saving OAuth tokens to secure storage
  3. However, subscription fetch fails: Failed to fetch subscription: AxiosError: Request failed with status code 401
  4. All subsequent API calls fail with:
   Error: Could not resolve authentication method. Expected either apiKey or authToken to be set.

What Should Happen?

  • OAuth login should complete successfully
  • Extension should be able to make API calls using the obtained tokens

Error Messages/Logs

2025-11-12 13:48:55.394 [info] Handling manual auth code input
2025-11-12 13:48:56.740 [error] Failed to fetch subscription: AxiosError: Request failed with status code 401
2025-11-12 13:48:56.741 [info] Saving OAuth tokens to secure storage
2025-11-12 13:48:56.741 [info] Login successful
2025-11-12 13:48:56.741 [info] Getting authentication status
2025-11-12 13:48:56.741 [info] OAuth tokens found in secure storage
2025-11-12 13:48:56.741 [info] Auth status: method=claudeai

2025-11-12 13:49:05.629 [info] From claude: [ERROR] Error streaming, falling back to non-streaming mode: Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted

2025-11-12 13:49:05.644 [info] From claude: [ERROR] Error in non-streaming fallback: Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted

Steps to Reproduce

  1. Install Claude Code extension v2.0.37 in VS Code
  2. Connect to remote Linux server via Remote-SSH
  3. Environment has proxy configured:
   https_proxy=10.109.31.28:3128
  1. Open Claude Code and attempt to login using "Sign in with Claude.ai"
  2. Complete OAuth flow in browser
  3. Submit OAuth code in VS Code

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

None

Claude Code Version

2.0.37

Platform

Anthropic API

Operating System

Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

Environment
  • OS: Rocky Linux 9.4 (Remote Development)
  • VS Code Version: Remote SSH
  • Claude Code Extension Version: 2.0.37
  • Network: Behind corporate proxy (10.109.31.28:3128)
  • Development Environment: Remote development via VS Code Remote-SSH from Windows 11
Description

Claude Code extension fails to authenticate using OAuth (claudeai) method when working in a remote development environment with a corporate proxy. The OAuth flow appears to complete, but all subsequent API calls fail with authentication errors.

Network Connectivity Test

API endpoint is reachable through the proxy:

$ curl -v https://api.anthropic.com/v1/messages \
  -H "content-type: application/json" \
  -H "x-api-key: test"

* Uses proxy env variable https_proxy == '10.109.31.28:3128'
* Connected to 10.109.31.28 (10.109.31.28) port 3128 (#0)
< HTTP/1.1 200 Connection established
< HTTP/2 405 
# ... (Connection successful, returns expected 405 Method Not Allowed for GET)
Analysis

The issue appears to be that:

  1. OAuth tokens are successfully obtained and stored
  2. However, when the extension tries to use these tokens, they are either:
  • Not properly retrieved from secure storage in remote environment
  • Not correctly passed to the API client
  • Invalid/expired before being used
  1. The proxy environment may be interfering with the OAuth token exchange or validation process
Additional Context
  • Remote development environments may have limited secure storage capabilities
  • VS Code Remote-SSH proxy settings might not be properly inherited by the extension
  • The extension should respect both VS Code's http.proxy setting and system environment variables (HTTP_PROXY, HTTPS_PROXY)

View original on GitHub ↗

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