feat(claude-code): add manual auth flow for remote environments#10549
Closed
roomote-v0[bot] wants to merge 1 commit intomainfrom
Closed
feat(claude-code): add manual auth flow for remote environments#10549roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
This adds an alternative OAuth flow for users in remote environments like GitHub Codespaces where localhost redirects do not work. The implementation includes: - New OOB (out-of-band) redirect URI support in oauth.ts - startManualAuthorizationFlow() and exchangeManualCode() methods - UI updates in ClaudeCode.tsx with manual code entry option - New message types: claudeCodeStartManualAuth, claudeCodeSubmitManualCode Users can click "Sign in manually" to start the flow, then copy the authorization code from the browser and paste it into Roo Code. Closes #10531
Contributor
Author
Review complete. No issues found. The implementation correctly adds manual OAuth flow support for remote environments. Key observations:
Note from PR author (verified): The OOB redirect URI ( Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR attempts to address Issue #10531 where Claude Code sign-in is broken in remote environments (like GitHub Codespaces) due to hardcoded localhost redirectUri.
Changes
Based on the feedback from @soundyogi, this implements a manual authorization code entry flow similar to how Claude Code itself handles this scenario:
Backend Changes (
src/integrations/claude-code/oauth.ts)oobRedirectUriconstant for OOB (out-of-band) OAuth flowbuildManualAuthorizationUrl()function using OOB redirectexchangeManualCodeForTokens()function for manual code exchangestartManualAuthorizationFlow()method toClaudeCodeOAuthManagerexchangeManualCode()method to exchange manually-entered codeshasPendingManualAuth()helper methodFrontend Changes (
webview-ui/src/components/settings/providers/ClaudeCode.tsx)Message Handler Updates (
src/core/webview/webviewMessageHandler.ts)claudeCodeStartManualAuthcase to start manual auth flowclaudeCodeSubmitManualCodecase to exchange manually-entered codesType Definitions
claudeCodeStartManualAuthandclaudeCodeSubmitManualCodetoWebviewMessage.tsclaudeCodeManualAuthStartedtoExtensionMessage.tsHow It Works
Testing
src/andwebview-ui/Note
The OOB redirect URI (
urn:ietf:wg:oauth:2.0:oob) is a standard OAuth pattern. However, whether Anthropic's OAuth endpoint supports this redirect URI needs to be verified. If they use a different approach (like a custom callback page), the implementation may need adjustment.Feedback and guidance are welcome!
Important
Add manual OAuth flow for remote environments in Claude Code, including backend, frontend, and message handler updates.
oauth.ts):oobRedirectUrifor OOB OAuth flow.buildManualAuthorizationUrl()andexchangeManualCodeForTokens()for manual code handling.startManualAuthorizationFlow()andexchangeManualCode()toClaudeCodeOAuthManager.ClaudeCode.tsx):webviewMessageHandler.ts):claudeCodeStartManualAuthandclaudeCodeSubmitManualCodecases for manual auth flow.claudeCodeStartManualAuthandclaudeCodeSubmitManualCodetoWebviewMessage.ts.claudeCodeManualAuthStartedtoExtensionMessage.ts.This description was created by
for 63afd92. You can customize this summary. It will automatically update as commits are pushed.