Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 8, 2026

Summary

This PR attempts to address Issue #10531 - Claude Code Sign In broken on remote environments due to hardcoded localhost redirectUri.

Problem

The OAuth flow for Claude Code uses a hardcoded localhost redirect URI (http://localhost:54545/callback) which does not work in remote environments like GitHub Codespaces, SSH sessions, or vscode.dev on mobile devices.

Solution

Implements an out-of-band (OOB) OAuth flow as suggested by @soundyogi, similar to how Claude Code CLI handles this:

  1. User clicks "Using a remote environment? Click here for manual sign in"
  2. User clicks "Open Authentication Page" which opens an auth URL with OOB redirect URI
  3. After signing in on Anthropic's page, user sees an authorization code
  4. User pastes the code into the input field in Roo Code
  5. Code is exchanged for tokens, completing the sign-in

Changes

  • oauth.ts: Added OOB redirect URI constant, buildOobAuthorizationUrl(), exchangeOobCodeForTokens() functions, and startOobAuthorizationFlow(), exchangeManualCode(), hasPendingOobFlow() methods to the OAuth manager
  • WebviewMessage.ts: Added claudeCodeStartOobFlow and claudeCodeExchangeManualCode message types
  • webviewMessageHandler.ts: Added handlers for the new OOB flow messages
  • ClaudeCode.tsx: Added step-by-step UI for manual auth flow with state management
  • settings.json: Added i18n translations for the new auth flow

Testing

  • The OOB flow uses the standard OAuth 2.0 OOB redirect URI (urn:ietf:wg:oauth:2.0:oob)
  • The existing localhost callback flow remains unchanged for local development
  • CI will validate the changes

Feedback and guidance are welcome!


Important

Adds manual OAuth flow for remote environments in oauth.ts and ClaudeCode.tsx, allowing users to authenticate using an out-of-band redirect URI.

  • Behavior:
    • Adds manual OAuth flow for remote environments in oauth.ts using OOB redirect URI (urn:ietf:wg:oauth:2.0:oob).
    • Users can manually enter auth code in ClaudeCode.tsx UI after signing in on Anthropic's page.
  • Functions:
    • Adds buildOobAuthorizationUrl(), exchangeOobCodeForTokens() in oauth.ts.
    • Adds startOobAuthorizationFlow(), exchangeManualCode(), hasPendingOobFlow() methods to ClaudeCodeOAuthManager.
  • UI:
    • Updates ClaudeCode.tsx to include manual auth flow UI components.
    • Adds i18n translations for new auth flow in settings.json.
  • Messages:
    • Adds claudeCodeStartOobFlow, claudeCodeExchangeManualCode message types in WebviewMessage.ts.
    • Handles new message types in webviewMessageHandler.ts.

This description was created by Ellipsis for 40a9d5a. You can customize this summary. It will automatically update as commits are pushed.

Adds out-of-band (OOB) OAuth flow for Claude Code sign-in that works in
remote environments like GitHub Codespaces and SSH sessions where
localhost callbacks do not work.

Changes:
- Add OOB redirect URI constant and buildOobAuthorizationUrl function
- Add exchangeOobCodeForTokens function for manual code exchange
- Add startOobAuthorizationFlow and exchangeManualCode methods to manager
- Add claudeCodeStartOobFlow and claudeCodeExchangeManualCode message types
- Add webview handlers for the new message types
- Update ClaudeCode.tsx with manual auth UI (step-by-step flow)
- Add i18n translations for the new auth flow

Fixes #10531
@roomote
Copy link
Contributor Author

roomote bot commented Jan 8, 2026

Rooviewer Clock   See task on Roo Cloud

Review completed. No actionable issues found.

The OOB OAuth flow implementation is well-structured and follows existing patterns. The code correctly uses PKCE for security, handles errors appropriately, and maintains proper state management.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jan 8, 2026
@hannesrudolph hannesrudolph changed the title feat(claude-code): add manual auth code flow for remote environments feat(claude-code): add manual auth code flow for remote environments [COM-371] Jan 9, 2026
@hannesrudolph hannesrudolph changed the title feat(claude-code): add manual auth code flow for remote environments [COM-371] feat(claude-code): add manual auth code flow for remote environments Jan 9, 2026
@hannesrudolph hannesrudolph changed the title feat(claude-code): add manual auth code flow for remote environments feat(claude-code): add manual auth code flow for remote environments [COM-371] Jan 9, 2026
@hannesrudolph hannesrudolph changed the title feat(claude-code): add manual auth code flow for remote environments [COM-371] feat(claude-code): add manual auth code flow for remote environments Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

3 participants