Skip to content

Remove username prompt on buf registry login #3128

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

Merged
merged 6 commits into from
Jul 8, 2024
Merged

Conversation

emcfarlane
Copy link
Contributor

@emcfarlane emcfarlane commented Jul 4, 2024

This removes the requirement to provide your username when calling buf registry login. On login the token is validated by fetching the current user. The username is used only to validate that the current token is associated with the user but is otherwise redundant. The flag has now been marked deprecated and is hidden.

The output of the login command is also updated to be more user friendly prompting the user to visit the web UI to create a token if they do not have one. On successful login the user is informed that they are logged in as the current user.

Token via prompt:

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

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

Token via stdin:

$ echo ${BUF_TOKEN} | buf registry login buf.build --token-stdin
Logged in as emcfarlane. Credentials saved to /Users/edward/.netrc.

This removes the requirement to provide your username when calling buf
registry login. On login the token is validated by fetching the current
user. The username is used only to validate that the current token is
associated with the user but is otherwise redundant. The flag is kept
and will validate the username if provided.

The output of the login command is also updated to be more user friendly
prompting the user to visit the web UI to create a token if they do not
have one. On successful login the user is informed that they are logged
in as the current user.
Copy link
Contributor

github-actions bot commented Jul 4, 2024

The latest Buf updates on your PR.

NameStatus
build✅ passed
lint✅ passed
format✅ passed
breaking✅ passed

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.

This makes a lot of sense to me. I like that --username continues to be available -- I mulled over whether we should consider marking the flag as deprecated, but I think the fact that it continues to provide validation makes a lot of sense.

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.

We should probably add a changelog entry to this.

@emcfarlane emcfarlane merged commit 2df4a13 into main Jul 8, 2024
12 checks passed
@emcfarlane emcfarlane deleted the ed/loginOnlyToken branch July 8, 2024 00:52
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.

3 participants