auth: mint tokens from a custom OAuth app - #517
Draft
andy-xu-db wants to merge 1 commit into
Draft
Conversation
This was referenced Sep 8, 2026
Add --oauth-client-id to the token helper and route custom-app sessions through the PKCE token cache. Resolve saved client IDs by workspace host while preserving existing bearer and Databricks CLI behavior.
andy-xu-db
force-pushed
the
andy-xu_data/stack/oauth-pkce-module
branch
from
September 8, 2026 20:34
8ad18a8 to
196a2c6
Compare
andy-xu-db
force-pushed
the
andy-xu_data/stack/oauth-auth-token-flag
branch
from
September 8, 2026 20:34
82d4a9d to
b66c32d
Compare
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.
What this does
Adds
ug auth-token --oauth-client-id <id>, so any token ucode mints can come from a custom OAuth app using #516's flow.The switch lives inside
get_databricks_token: if a client id resolves for the requested host, mint throughucode.oauthinstead of shelling out todatabricks auth token. Deciding there rather than at each call site is what makes all ~50 callers work unchanged, including the agents that mint directly and never touch the argv builders.Resolution is by host — flag →
UCODE_OAUTH_CLIENT_ID(CI) → the host's saved entry — because agents bake--hostinto their configs and routinely ask about a workspace that isn't current.Also:
ug mcp-proxy --oauth-client-idand both routing hooks accept it; the argv builders pin it into generated configs;has_valid_databricks_authandrun_databricks_logintake the custom path, so a missing custom-app session isn't mistaken for the built-in app's live one.DATABRICKS_BEARERstill short-circuits ahead of all of it.ucode configurewiring is #518. Jira: AIGTWY-4550Testing
uv run pytest2,322 passed (+32, same 21 pre-existing failures);ruff check,ruff format --check,ty check src/clean. New tests cover host-keyed resolution, flag/env/state precedence, theget_databricks_tokenbranch, argv pinning, and the login/validity checks.🥞 Stacked PR
This pull request and its description were written by Isaac.