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

[CLI] bb login should be a no-op if the user already has a valid API key #6468

Closed
brentleyjones opened this issue Apr 30, 2024 · 4 comments · Fixed by #6472
Closed

[CLI] bb login should be a no-op if the user already has a valid API key #6468

brentleyjones opened this issue Apr 30, 2024 · 4 comments · Fixed by #6472
Assignees

Comments

@brentleyjones
Copy link
Contributor

Is your feature request related to a problem? Please describe.

bb login currently always opens a webpage, even if the user is logged in.

Describe the solution you'd like

bb login should instead do nothing when the user is logged it, probably with a message telling them they are already logged in.

Describe alternatives you've considered

We could check git config --local buildbuddy.api-key before calling bb login, but that only tells us if they have an API key set. It doesn't tell us if that key is valid. bb login should be able to do both of those steps, and only direct them to the web page if they need to do something there.

@sluongng
Copy link
Contributor

I think making bb login conditionally open the browser is a great idea!

However, I am a bit skeptical regarding making a network call to check the API Key validity.
A network call could be flaky and fail due to all sorts of reasons. 🤔

Let me check with the team to see if there is a better way.

sluongng added a commit that referenced this issue Apr 30, 2024
Also call GetUser when API key is found so that we could check if the
key is still valid.

Close #6468
@sluongng sluongng self-assigned this May 1, 2024
sluongng added a commit that referenced this issue May 13, 2024
Also call GetUser when API key is found so that we could check if the
key is still valid.

Close #6468
@brentleyjones
Copy link
Contributor Author

Gentle ping on this. We would like to add bb login into a common flow of ours.

@sluongng
Copy link
Contributor

Sorry about that. My PR is going through review but folks are OOO 😅

I will try to push the fix forward for a release next week 🙇

@bduffany
Copy link
Member

This is being built and deployed now. Once it's done, you can use bb login --allow_existing to skip login if there is an existing, valid API key.

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 a pull request may close this issue.

3 participants