[BUG] OAuth Authentication Error: Missing client_id parameter in WSL environment
Issue Report: OAuth Authentication Error in WSL Environment
Environment Details
- Operating System: Windows 11 with WSL2
- WSL Distribution: Ubuntu 24.04.1 LTS
- WSL Kernel: 5.10.16.3-microsoft-standard-WSL2
- Node.js Version: v18.19.1
- npm Version: 9.2.0
- Claude Code Version: 0.2.100
Issue Description
When attempting to authenticate Claude Code in WSL2, the OAuth process consistently fails with the error "Invalid OAuth Request - Missing client_id parameter". This occurs despite the client_id being present in the OAuth URL. The error appears when clicking the authentication URL in a browser.
Steps to Reproduce
- Installed Claude Code in WSL using
npm install -g @anthropic-ai/claude-code - Created an Anthropic Console account and purchased API credits ($5)
- Generated an API key in the Anthropic Console
- Ran
claudecommand in a project directory - Selected theme preferences (Dark mode)
- Selected authentication method (Anthropic Console - API usage billing)
- Copied the OAuth URL provided by Claude Code
- Opened the URL in a browser
- Consistently received the "Invalid OAuth Request - Missing client_id parameter" error
Error Messages
Browser didn't open? Use the url below to sign in:
https://console.anthropic.com/oauth/authorize?code=true&client_id=9d1c250a-e61b-44d9-88ed-5944d1962f5e&response_type=code&redirect_uri=https%3A%2F%2Fconsole.anthropic.com%2Foauth%2Fcode%2Fcallback&scope=org%3Acreate_api_key+user%3Aprofile+user%3Ainference&code_challenge=QvjXUbJw3MMoU-BFv2pvUCZPk24nxmRYUsaXILVhCh4&code_challenge_method=S256&state=tp-waf3sqOGfzxEdg_H3RLuoHaeVcjTO1FTk_CduCyI
Invalid OAuth Request
Missing client_id parameter
Attempted Solutions
- Direct API key configuration:
- Set API key via environment variable:
export ANTHROPIC_API_KEY="sk-ant-api03..." - Verified the environment variable was set:
echo $ANTHROPIC_API_KEY - Configured model versions:
export ANTHROPIC_MODEL="claude-3-7-sonnet-20250219"
- WSL configuration:
- Verified Node.js is properly installed in WSL:
which nodeshows/usr/bin/node - Verified npm is properly installed in WSL:
which npmshows/usr/bin/npm
- Reinstallation attempts:
- Uninstalled Claude Code:
npm uninstall -g @anthropic-ai/claude-code - Cleared npm cache:
npm cache clean --force - Reinstalled Claude Code:
npm install -g @anthropic-ai/claude-code
- OAuth bypass attempts:
- Tried setting
export CLAUDE_CODE_SKIP_OAUTH=true - Tried creating a configuration file:
~/.config/claude-code/config.json
Expected Behavior
The OAuth URL should properly include the client_id parameter, and the browser should display the Anthropic authorization page rather than an error message.
Observations
The issue appears to be specific to the WSL environment. The client_id is present in the URL (9d1c250a-e61b-44d9-88ed-5944d1962f5e), but the OAuth request fails, suggesting a possible issue with how OAuth requests are handled when bridging from WSL to Windows browsers.
Additional Notes
I've successfully set up an API key and credits in the Anthropic Console but cannot use Claude Code in WSL due to this authentication issue. Using the console.anthropic.com web interface works without issues.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗