Skip to content

fix: allow browser login to work in containerized environments#31

Open
miguelsanchez-upsun wants to merge 2 commits intomainfrom
allow-browser-login-through-containers
Open

fix: allow browser login to work in containerized environments#31
miguelsanchez-upsun wants to merge 2 commits intomainfrom
allow-browser-login-through-containers

Conversation

@miguelsanchez-upsun
Copy link
Contributor

Bind the OAuth callback server to 0.0.0.0 instead of 127.0.0.1 to allow connections from outside the container, while still showing 127.0.0.1 in the user-facing URL for clarity.

Bind the OAuth callback server to 0.0.0.0 instead of 127.0.0.1 to allow
connections from outside the container, while still showing 127.0.0.1 in
the user-facing URL for clarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 16, 2026 10:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the legacy CLI browser-based OAuth login flow to work when the CLI runs inside a container by binding the temporary PHP callback server to 0.0.0.0, while continuing to present 127.0.0.1 as the callback URL shown to users.

Changes:

  • Bind the local OAuth callback server to 0.0.0.0 instead of 127.0.0.1.
  • Keep the user-facing callback URL as http://127.0.0.1:<port>.
  • Add extra output in the manual-open-URL path.
Comments suppressed due to low confidence (1)

legacy/src/Command/Auth/BrowserLoginCommand.php:188

  • Printing $localAddress (e.g. 0.0.0.0:5000) is not a URL users can open in a browser, and it contradicts the intent of keeping the user-facing URL as 127.0.0.1. Consider removing this line, or replace it with a proper alternative URL that is actually usable in container scenarios (e.g. http://localhost:$port or a message explaining port-mapping).
            $this->stdErr->writeln('Please open the following URL in a browser and log in:');
            $this->stdErr->writeln('<info>' . $localUrl . '</info>');
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +127 to +130
// Bind to 0.0.0.0 to allow access from outside the container/localhost
$localAddress = '0.0.0.0:' . $port;
// Use 127.0.0.1 for the URL shown to users
$localUrl = 'http://127.0.0.1:' . $port;
Comment on lines +127 to +129
// Bind to 0.0.0.0 to allow access from outside the container/localhost
$localAddress = '0.0.0.0:' . $port;
// Use 127.0.0.1 for the URL shown to users
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

Successfully merging this pull request may close these issues.

2 participants