feat: Add device auth login#828
Draft
lox wants to merge 1 commit into
Draft
Conversation
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.
Problem
bk auth logincurrently assumes a browser can be opened on the same machine that is running the CLI and that a localhost callback can be reached. That is awkward or impossible in common headless cases, especially SSH sessions, remote development boxes, and other environments where the user can authorize in a separate browser but cannot rely on loopback browser OAuth.Buildkite now has OAuth device authorization endpoints, so the CLI should be able to start an RFC-style device flow and poll for the resulting access token without opening a browser callback listener.
What changed
bk auth login --device.--device --tokenand--device --orgcombinations; device flow chooses the organization on the authorization page.invalid_scope,authorization_pending, andslow_downpolling behavior.Validation
mise exec -- go test ./pkg/oauth ./cmd/auth -count=1mise exec -- go test ./cmd/preflight -run 'TestPreflightCmd_Run/returns_user_aborted_when_canceled_during_snapshot_push' -count=1mise exec -- go test ./internal/preflight -run 'TestSnapshotContext_CancelsPush' -count=1mise exec -- go test ./...mise exec -- golangci-lint run --verbose --timeout 3mmise run build./dist/bk auth login --help