OAuth login broken for remote/headless server setups

Status Fixed / completed
Maintainer reply ✓ Yes — claude[bot]
Activity 7 comments · opened Apr 3, 2026 · closed May 1, 2026
💡 Likely answer: A maintainer (claude[bot], contributor) responded on this thread — see the highlighted reply below.

Description

claude auth login OAuth flow is broken when Claude Code runs on a remote server and the browser is on a separate local machine. The authorization code callback is not being exchanged for a token.

Setup

  • Claude Code running on a remote Linux server (SSH)
  • Browser on a separate local machine
  • Using Remote Control feature, which requires full-scope OAuth login (not long-lived tokens)

Steps to Reproduce

  1. Run claude auth login on a remote server
  2. OAuth flow directs to browser on local machine
  3. Browser completes authorization, receives callback URL: https://platform.claude.com/oauth/code/callback?code=<code>&state=<state>
  4. The authorization code is never exchanged — the local listener on the server doesn't receive the callback

Expected Behavior

The OAuth flow should complete successfully, exchanging the authorization code for a full-scope token, even when the browser and CLI are on different machines.

Actual Behavior

The callback URL isn't routed back to the CLI's listener on the remote server. The user sees the code in the browser URL but has no way to manually provide it to the CLI. Remote Control reports: "Remote Control requires a full-scope login token."

Notes

  • This reportedly worked previously and has regressed
  • Workarounds like SSH port forwarding or copying credentials from a local machine exist but shouldn't be necessary
  • A device-code flow or manual code-paste option would solve this for headless/remote environments

View original on GitHub ↗

7 Comments

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/35714
  2. https://github.com/anthropics/claude-code/issues/31007
  3. https://github.com/anthropics/claude-code/issues/30369

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

michidk · 4 months ago

Same issue when running Claude Code in WSL.

onsails · 4 months ago

same in openshell

ADyerVEP · 4 months ago

bump

prismon · 4 months ago

Bump?

claude[bot] contributor · 4 months ago

This issue was fixed as of version 2.1.126.

github-actions[bot] · 3 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.