Skip to content

Split device code login into authorization and token exchange steps - #7217

Open
maksim-zuev-db wants to merge 3 commits into
mainfrom
device-code-split-steps
Open

maksim-zuev-db wants to merge 3 commits into
mainfrom
device-code-split-steps

Conversation

@maksim-zuev-db

@maksim-zuev-db maksim-zuev-db commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Changes

A refactoring for the upcoming non-interactive device code login flow, with no user-visible change. libs/auth/u2m exports the two steps of device code login, RequestDeviceAuthorization and ExchangeDeviceCode, and DeviceCodeChallenge is rebuilt on top of them. A rejected code matches ErrInvalidConfirmationCode or ErrInvalidDeviceCode, and NormalizeCode is exported.

Why

In the non-interactive flow, used when stdin is not a terminal (e.g. when an AI agent runs the login), one CLI invocation requests the device authorization and a later one exchanges the device code. The test migration (#7222) and the flow itself (#7220) are stacked on top.

Tests

New unit tests for both steps and their errors. Existing tests pass unchanged.

This pull request and its description were written by Isaac.

Export RequestDeviceAuthorization and ExchangeDeviceCode so a login can be
completed by a separate command, and rebuild DeviceCodeChallenge on top of
them. Rejected codes now match ErrInvalidConfirmationCode or
ErrInvalidDeviceCode, so callers no longer compare the server's description.
Export NormalizeCode so that callers can compare codes the way the user
enters them.

Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 113e772

Run: 40707502897

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 281 15 6:34
✅​ aws-windows-latest-4core-16gb 283 13 4:06
✅​ azure linux-2core-8gb 280 15 6:57
✅​ azure-windows-latest-4core-16gb 282 13 3:47
✅​ gcp linux-2core-8gb 281 15 5:44
✅​ gcp-windows-latest-4core-16gb 283 13 4:43
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:01 aws-windows-latest-4core-16gb TestAccept
3:56 aws linux-2core-8gb TestAccept
3:51 azure linux-2core-8gb TestAccept
3:43 gcp linux-2core-8gb TestAccept
3:42 gcp-windows-latest-4core-16gb TestAccept
3:40 azure-windows-latest-4core-16gb TestAccept

RequestDeviceAuthorization errors already say which step failed, and
DeviceCodeChallenge adds the same prefix to its token exchange errors.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@maksim-zuev-db
maksim-zuev-db removed this pull request from stack #7223 October 28, 2026 15:48
@maksim-zuev-db
maksim-zuev-db removed this pull request from stack #7236 October 28, 2026 15:57
@maksim-zuev-db
maksim-zuev-db marked this pull request as ready for review October 28, 2026 15:58
@maksim-zuev-db
maksim-zuev-db requested review from a team as code owners October 28, 2026 15:58
@maksim-zuev-db
maksim-zuev-db requested review from renaudhartert-db and removed request for renaudhartert-db October 28, 2026 15:58

This branch has not been deployed

No deployments
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