fix: allow browser login to work in containerized environments#31
Open
miguelsanchez-upsun wants to merge 2 commits intomainfrom
Open
fix: allow browser login to work in containerized environments#31miguelsanchez-upsun wants to merge 2 commits intomainfrom
miguelsanchez-upsun wants to merge 2 commits intomainfrom
Conversation
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>
Contributor
There was a problem hiding this comment.
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.0instead of127.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:$portor 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 |
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.
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.