Skip to content

Enhance GitHub authentication localhost flow with auto-redirect to VS Code #251226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 11, 2025

When logging into GitHub from an extension, users currently see a confirmation page where "Cancel" appears as the main CTA, creating a poor user experience. This PR implements an enhanced localhost authentication flow that provides better UX.

Changes

Enhanced Success Page

  • Updated the localhost success page to show a clear "You are signed in!" message
  • Added subtitle "Taking you back to VS Code..." to indicate the automatic redirect
  • Improved visual styling with better typography and centered layout

Auto-Redirect Functionality

  • Implemented JavaScript logic to automatically redirect users back to VS Code after 1.5 seconds
  • Uses vscode:// protocol to seamlessly return to the editor
  • Includes graceful fallback to "You can close this page now" if protocol redirect fails

User Experience Improvements

  • Users see clear confirmation of successful authentication
  • Eliminates need to manually close browser tabs
  • Maintains existing error handling for failed authentication

Technical Details

The implementation modifies only the static HTML and CSS files served by the existing LoopbackAuthServer:

  • media/index.html: Enhanced messaging and auto-redirect logic
  • media/auth.css: Added styles for success title and subtitle

This approach follows the pattern mentioned in the issue comments, similar to the MCP dynamic auth provider flow, where the localhost page shows success confirmation before automatically redirecting back to VS Code.

Benefits

  • Better UX: Clear success messaging instead of confusing "Cancel" CTA
  • Seamless Flow: Automatic return to VS Code without manual intervention
  • Minimal Risk: Only UI changes, no modifications to authentication logic
  • Backward Compatible: Preserves all existing functionality

Fixes #250086.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits June 11, 2025 18:26
Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Explore different login paths Enhance GitHub authentication localhost flow with auto-redirect to VS Code Jun 11, 2025
@Copilot Copilot AI requested a review from TylerLeonhardt June 11, 2025 18:30
Copilot finished work on behalf of TylerLeonhardt June 11, 2025 18:30
@TylerLeonhardt
Copy link
Member

You need to actually look at the linked PR and see how this was done. It's more complicated than simply changing the html

Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Error loading sessions

Retrying..

Successfully merging this pull request may close these issues.

Explore different login paths
2 participants