Skip to content

Remove the requirement for setting --org, fixes browser bug#661

Merged
mcncl merged 2 commits intomainfrom
chore/login_org_flag_bug
Feb 24, 2026
Merged

Remove the requirement for setting --org, fixes browser bug#661
mcncl merged 2 commits intomainfrom
chore/login_org_flag_bug

Conversation

@mcncl
Copy link
Contributor

@mcncl mcncl commented Feb 24, 2026

Description

Currently there are a couple of minor bugs in the auth login flow;

  • a user should be able to run bk auth login and be taken to the browser (currently --org required)
  • when setting --org currently, there is a caching issue where the most recent auth'd org is selected
    • this means the user has to select the correct org, deeming --org useless anyway

Changes

  • removes the org flag from login entirely;
    • currently it's ignored anyway because of browser caching or something
    • the most recently auth'd org will be pre-selected, no matter what --org is set to
    • this means a user could accidentally auth for an unintended org
  • allows bk auth login to be run, opening the browser and correctly associating with the manually selected org

Testing

  • Tests have run locally (with go test ./...)
  • Code is formatted (with go fmt ./...)

- a user should be able to run `bk auth login` and be taken to the browser
- when setting `--org` currently, there is a caching issue where the most recent auth'd org is selected
	- this means the user has to select the correct org, deeming `--org` useless anyway
@mcncl mcncl requested a review from a team as a code owner February 24, 2026 00:20

orgSlug := orgs[0].Slug
if len(orgs) > 1 {
fmt.Println("Token is authorized for multiple organizations:")
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are sticking to the first org, should we ask if they want to change or choose a different one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was copy/pasted from some other logic and not cleaned up; we can't have a token with > 1 org, so we don't need that check

@mcncl mcncl force-pushed the chore/login_org_flag_bug branch from dad7486 to 56c89e3 Compare February 24, 2026 02:08
Copy link
Contributor

@PriyaSudip PriyaSudip left a comment

Choose a reason for hiding this comment

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

Looks good now.

@mcncl mcncl merged commit 58aef32 into main Feb 24, 2026
1 check passed
@mcncl mcncl deleted the chore/login_org_flag_bug branch February 24, 2026 03:21
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.

2 participants