Repository navigation
Add browser login to airflowctl - #75938
Open
baptistegh wants to merge 3 commits into
Open
baptistegh wants to merge 3 commits into
baptistegh wants to merge 3 commits into
Conversation
Users who sign in to Airflow through SSO or with a second factor have no password to give airflowctl, so they could only log in by copying a token from somewhere else. Auth managers can now advertise a browser login through the CLI login discovery route, and airflowctl can use it without knowing which auth manager serves it. Servers without discovery, or whose auth manager does not offer browser login, fail with a clear message instead of a silent wait for a browser redirect that never comes. Generated-by: Claude Code (Opus 5.5) Signed-off-by: Baptiste Gouhoury <gouhoury.baptiste@gmail.com>
2 tasks done
The login URL was printed to stdout, so capturing the output of `auth token --sso` also captured the URL and the user never saw it. It was also wrapped at the terminal width, which breaks copying it with --no-browser. Generated-by: Claude Code (Opus 5.5) Signed-off-by: Baptiste Gouhoury <gouhoury.baptiste@gmail.com>
Contributor
Author
|
Tested end to end in breeze with Keycloak and #75913: |
vincbeck
reviewed
Oct 29, 2026
The login metadata comes from the network, so an endpoint outside the API server would have received the code, the PKCE verifier and any stored token. Authorization codes are single use and identity providers can treat a replay as an attack, so the exchange must not be retried. Reviewers also pointed out that the browser reported success on failed logins and that an idle connection defeated --timeout. Error text from the server could crash the output, and auth token ignored the arguments that --sso is documented to refuse.
Contributor
Author
|
Pushed a follow-up commit with the review fixes. While in there I also fixed a few things that weren't raised in review:
|
This branch has not been deployed
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.
Users who sign in to Airflow through SSO or with a second factor have no password to give airflowctl. This adds
airflowctl auth login --sso(andauth token --sso), which logs in through the browser when the API server's auth manager offers it through the CLI login discovery route from #75672.airflowctl only follows the contract documented in core, so it doesn't know or care which auth manager serves it. The Keycloak auth manager is the first to offer browser login, in #75913. The two PRs are independent and can be merged in either order.
related: #75560
Changes
auth login --sso/auth token --ssoreadGET /api/v2/auth/cli/metadata. They needauthorization_codewithS256and both endpoints, otherwise they fail at once with "does not offer browser login (--sso)". A 404 (an API server without discovery) counts as offering nothing.S256, RFC 7636) over a loopback redirect (RFC 8252): a one-shot HTTP server on127.0.0.1with a random port, a randomstatechecked on return, and no request logging, so the code never reaches stderr.--no-browseronly prints the login URL (for example overssh -L). It is not the device code flow, which comes in a later PR.--timeout(default 300 seconds) bounds the wait for the browser.--ssorefuses--api-token,--username,--passwordand--skip-keyring.start.rstdescribes the new login, and theauth loginhelp image is regenerated.Not included: refreshing the CLI token with the
refresh_tokengrant, and the device code flow. Both follow in separate PRs.Trying it
With #75913 and
[keycloak_auth_manager] cli_authorization_code_enabled = True:Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines