Skip to content
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

Update buf registry login to use browser by default #3167

Merged
merged 19 commits into from
Aug 1, 2024
Merged

Conversation

emcfarlane
Copy link
Contributor

@emcfarlane emcfarlane commented Jul 17, 2024

Updates the command buf registry login to use the brower login flow. On login, the users browser will be opened prompting the user to approve or deny access to the device. This simplifies the login flow avoiding the steps previously required to create an access token before providing it to the CLI.

$ buf registry login
Opening your browser to complete authorization process.

If your browser doesn't open automatically,
please open this URL in a browser to complete the process:
        https://buf.build/settings/user/device?code=Z8YJ-8FGD

Logged in as emcfarlane. Credentials saved to /Users/edward/.netrc.

The flag --no-browser may be provided to disable the browser flow and prompt the user for the access token. The flag --token-stdin behaviour remains the same as before. Providing both flags is an error.

$ buf registry login --no-browser
Enter the BSR token created at https://buf.build/settings/user.

Token:
Logged in as emcfarlane. Credentials saved to /Users/edward/.netrc.

Updates the command `buf registry login` to use the brower login flow.
Users will be prompted to complete the flow in the browser authorizing
the device and providing it an access token.
@emcfarlane emcfarlane requested a review from doriable July 17, 2024 22:26
Copy link
Contributor

github-actions bot commented Jul 17, 2024

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 1, 2024, 9:45 PM

@emcfarlane emcfarlane marked this pull request as ready for review July 26, 2024 07:10
Copy link
Member

@doriable doriable left a comment

Choose a reason for hiding this comment

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

I tested the workflow on Windows, in Powershell, and it does not seem to behave as intended, instead of getting the browser open, it opened a new Command Prompt window, and then when I went to the link directly, an error occurred.

private/pkg/open/exec_windows.go Outdated Show resolved Hide resolved
private/pkg/open/exec_windows.go Outdated Show resolved Hide resolved
var (
// ErrUnsupported is returned when we receive an unsupported response from the server.
//
// TODO(go1.21): replace by errors.ErrUnsupported once it is available.
Copy link
Member

Choose a reason for hiding this comment

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

Once this PR is merged, make sure to merge main into #3123 and delete this

Copy link
Member

Choose a reason for hiding this comment

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

I did this FYI

@bufdev bufdev changed the title Registry login with browser flow Update buf registry login to use browser by default Aug 1, 2024
@bufdev bufdev merged commit 06c2619 into main Aug 1, 2024
12 checks passed
@bufdev bufdev deleted the ed/browserLoginImpl branch August 1, 2024 21:50
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.

4 participants