fix: add localhost HTTP server fallback for OAuth on Linux (#12122)#12123
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: add localhost HTTP server fallback for OAuth on Linux (#12122)#12123roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
On Linux desktop environments (e.g., xfce4, some Wayland compositors), the vscode:// custom URI scheme does not work, preventing the OAuth callback from reaching the extension after browser authentication. This adds a LocalAuthServer that starts a temporary HTTP server on 127.0.0.1 with a random port to receive the OAuth callback directly, bypassing the need for custom URI scheme support. The server automatically shuts down after receiving the callback or on timeout (5 minutes). If the local server fails to start, it falls back to the original vscode:// URI scheme. Closes #12122
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.
Related GitHub Issue
Closes: #12122
Description
This PR attempts to address Issue #12122 where Linux users (xfce4, some Wayland compositors, and others) cannot complete Roo Cloud authentication because the
vscode://custom URI scheme does not work -- the browser redirect never reaches the extension viahandleUri.ts.The fix: Instead of relying on the
vscode://URI scheme for the OAuth callback, the extension now starts a temporary local HTTP server onhttp://127.0.0.1:<random-port>and uses that as theauth_redirectparameter. After browser authentication, the Roo Cloud website redirects to this localhost URL, which the extension receives directly -- no custom URI scheme needed.Key implementation details:
LocalAuthServer.ts-- A new class that starts a temporary HTTP server on a random available port, listens for the/auth/clerk/callbackendpoint, extracts auth params, responds with a success HTML page, and auto-shuts down.WebAuthService.login()-- Modified to start aLocalAuthServerbefore opening the browser. The localhost URL is used asauth_redirect. If the server fails to start, it falls back to the originalvscode://URI scheme.WebAuthService.handleCallback()-- Now callsstopLocalAuthServer()on entry to prevent double-processing if both the URI handler and local server fire.Fallback behavior: If the local HTTP server fails to start for any reason, the code falls back to the original
vscode://URI scheme behavior, so this change is backward-compatible.Feedback and guidance are welcome.
Test Procedure
LocalAuthServercovering: start/stop, callback handling, missing params, timeout, 404 for wrong pathsWebAuthServicetests updated and passing (2 tests updated to reflect the new localhostauth_redirectinstead ofvscode://)Pre-Submission Checklist
Documentation Updates
Additional Notes
This approach mirrors what tools like GitHub CLI (
gh) andgclouduse for OAuth on environments without custom URI scheme support. The Roo Cloud server needs to accepthttp://127.0.0.1:PORTas a validauth_redirectvalue for this to work end-to-end -- if the server validates/restricts redirect URLs, a server-side allowlist update may be needed.Interactively review PR in Roo Code Cloud