Repository navigation
Conversation
The web-based login flow opens the device confirmation URL with github.com/pkg/browser, which only tries a fixed set of launchers (xdg-open, x-www-browser, www-browser on Linux). In environments such as dev containers, none of these may be installed, and users need a way to forward the URL to a browser on the host. Use the command from the BROWSER environment variable when it is set, following the same convention as other tools such as the GitHub CLI. If the command can't be started, fall back to the default browser. Signed-off-by: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The command is chosen by the user through the BROWSER environment variable, so launching it is the intended behavior. Signed-off-by: Nimesh Kulkarni <167794819+GitNimay@users.noreply.github.com>
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
The web-based
docker loginflow opens the device confirmation URL withgithub.com/pkg/browser. On Linux, that only tries a fixed set of launchers (xdg-open,x-www-browser,www-browser). In dev containers, none of these may be installed. Users there need a way to forward the URL to the host browser.This PR makes the CLI use the command from the
BROWSERenvironment variable when it's set. Other tools use the same convention, for example the GitHub CLI (go-gh).BROWSER="my-url-opener --flag".BROWSERis unset or empty, the behavior is unchanged.$ BROWSER="my-url-opener --flag" docker loginChanges:
internal/oauth/manager: addedopenURL, which is now the defaultOpenBrowserimplementation.TestOpenURLWithBrowserEnv(setsBROWSER="touch -m"and checks that the command ran with the URL as its last argument).docs/reference/commandline/login.md: documented theBROWSERvariable for web-based login.Release notes (optional)