[DOCS] Auth login troubleshooting missing pasted OAuth code fallback for localhost callback failures

Status Fixed / completed
Maintainer reply None cached
Activity 3 comments · opened May 1, 2026 · closed May 10, 2026

Documentation Type

Incorrect/outdated documentation

Documentation Location

https://code.claude.com/docs/en/troubleshoot-install

Section/Topic

"OAuth login fails in WSL2" under "Login and authentication"

Current Documentation

The troubleshooting page currently says:

Browser-based login in WSL2 can fail in two ways: WSL can't open your Windows browser, or the terminal won't accept the pasted authorization code. If the browser opens but pasting the code back into the terminal does nothing, your terminal's paste binding likely isn't reaching the prompt. Try your terminal's alternate paste shortcut, often right-click or Shift+Insert in Windows Terminal, or run login outside the interactive UI: ``bash theme={null} claude auth login `` This fallback also applies on native Windows or any terminal where pasting the code into the interactive prompt fails.

What's Wrong or Missing?

Claude Code v2.1.126 added a more specific fallback: claude auth login can accept the OAuth code pasted into the terminal when the browser callback cannot reach localhost, such as in WSL2, SSH sessions, and containers.

The current troubleshooting section still frames claude auth login mainly as a workaround for terminal paste binding failures in the interactive UI. It does not tell users what to do when the browser login succeeds but the redirect/callback to localhost cannot complete, which is the exact remote/container scenario addressed by the v2.1.126 change.

The nearby authentication page does mention the generic prompt:

If your browser shows a login code instead of redirecting back after you sign in, paste it into the terminal at the Paste code here if prompted prompt.

But the troubleshooting page for WSL2 and related remote login failures does not connect that behavior to claude auth login or to localhost callback failures.

Suggested Improvement

Update the WSL2 troubleshooting section to include the v2.1.126 behavior. For example, after the claude auth login command, add:

If the browser completes sign-in but cannot redirect back to Claude Code because the localhost callback is unreachable, copy the OAuth code shown in the browser and paste it into the terminal when claude auth login prompts for it. This works in WSL2, SSH sessions, containers, and other environments where the browser and Claude Code process cannot communicate over localhost.

Optionally rename the section or add a short subsection so it covers "WSL2, SSH, and containers" rather than only WSL2.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/troubleshoot-install | 738-759 | WSL2 OAuth troubleshooting recommends claude auth login but does not mention pasted OAuth codes for unreachable localhost callbacks |
| https://code.claude.com/docs/en/authentication | 13-17 | General login docs mention pasting a browser code into the terminal, but not the claude auth login remote/container fallback |

Version context: Claude Code v2.1.126 added support for claude auth login accepting the OAuth code pasted into the terminal when the browser callback cannot reach localhost.

View original on GitHub ↗

3 Comments

github-actions[bot] · 5 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/55194

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

coygeek · 5 months ago

Issue #55186 Verification

Title: [DOCS] Auth login troubleshooting missing pasted OAuth code fallback for localhost callback failures
Issue Date: 2026-05-01
Verification Date: 2026-05-09
Status: RESOLVED

---

Issue Summary

This issue reports that the authentication troubleshooting docs did not explain that when the browser login succeeds but the localhost callback cannot reach Claude Code, the OAuth code shown in the browser can be pasted back into the terminal, especially for WSL2, SSH sessions, and containers.

---

Verification Results

Claim 1: The troubleshooting page was missing guidance for localhost callback failures in WSL2, SSH, or containers

Status: RESOLVED

At https://code.claude.com/docs/en/troubleshoot-install, lines 742-745 now state: ### OAuth login fails in WSL2, SSH, or containers and When Claude Code runs in WSL2, on a remote machine over SSH, or inside a container, the browser usually opens on a different host and its redirect can't reach Claude Code's local callback server. After you sign in, the browser shows a login code instead of redirecting back automatically. Paste that code into the terminal at the 'Paste code here if prompted' prompt to complete login.

Verdict: The troubleshooting page now directly describes the localhost callback failure mode and tells users to paste the browser-provided OAuth code into the terminal.

---

Claim 2: The troubleshooting page did not connect claude auth login to the pasted-code fallback for remote or container environments

Status: RESOLVED

At https://code.claude.com/docs/en/troubleshoot-install, lines 753-761 now state: Alternatively, press 'c' at the interactive login prompt to copy the OAuth URL, or copy the URL that 'claude auth login' prints, and open it in a browser on your local machine. The same section continues: If pasting the code into the interactive prompt does nothing, your terminal's paste binding likely isn't reaching the input field. Try your terminal's alternate paste shortcut, often right-click or Shift+Insert in Windows Terminal, or use 'claude auth login' instead, which reads the pasted code from standard input: followed by claude auth login on lines 757-758.

At https://code.claude.com/docs/en/authentication, lines 13-17 now state: If your browser shows a login code instead of redirecting back after you sign in, paste it into the terminal at the 'Paste code here if prompted' prompt. This happens when the browser can't reach Claude Code's local callback server, which is common in WSL2, SSH sessions, and containers.

Verdict: The current docs now connect the remote localhost-callback failure case to both the pasted-code flow and the claude auth login fallback.

---

Current State

| Claim | Status |
|-------|--------|
| Troubleshooting docs now explain localhost callback failures for WSL2, SSH, and containers | RESOLVED |
| Troubleshooting docs now connect pasted OAuth codes and claude auth login to that failure mode | RESOLVED |

---

Suggested Fix

N/A - issue has been resolved.

---

References

  • URL: https://code.claude.com/docs/en/troubleshoot-install
  • Lines 742-761: Troubleshooting section now covers OAuth login fails in WSL2, SSH, or containers, explains unreachable local callback redirects, instructs users to paste the browser code into the terminal, and documents claude auth login as the standard-input fallback.
  • URL: https://code.claude.com/docs/en/authentication
  • Lines 13-17: Authentication docs state that when the browser shows a login code instead of redirecting back, users should paste it into the terminal, and explicitly note that this is common in WSL2, SSH sessions, and containers.

---

Conclusion & Recommendation

Primary Concern: The issue reported missing documentation for the OAuth pasted-code fallback when browser login cannot complete the localhost callback in remote-style environments.

Resolution Status: RESOLVED

Recommendation: CLOSE

The current troubleshooting and authentication documentation now describe the localhost callback failure mode and the pasted-code fallback directly, including WSL2, SSH, containers, and the claude auth login path.

---

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.