Skip to content

auth: mint tokens from a custom OAuth app - #517

Draft
andy-xu-db wants to merge 1 commit into
andy-xu_data/stack/oauth-pkce-modulefrom
andy-xu_data/stack/oauth-auth-token-flag
Draft

auth: mint tokens from a custom OAuth app#517
andy-xu-db wants to merge 1 commit into
andy-xu_data/stack/oauth-pkce-modulefrom
andy-xu_data/stack/oauth-auth-token-flag

Conversation

@andy-xu-db

@andy-xu-db andy-xu-db commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

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 through ucode.oauth instead of shelling out to databricks 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 --host into their configs and routinely ask about a workspace that isn't current.

Also: ug mcp-proxy --oauth-client-id and both routing hooks accept it; the argv builders pin it into generated configs; has_valid_databricks_auth and run_databricks_login take the custom path, so a missing custom-app session isn't mistaken for the built-in app's live one. DATABRICKS_BEARER still short-circuits ahead of all of it.

ucode configure wiring is #518. Jira: AIGTWY-4550

Testing

uv run pytest 2,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, the get_databricks_token branch, argv pinning, and the login/validity checks.

🥞 Stacked PR


This pull request and its description were written by Isaac.

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
andy-xu-db force-pushed the andy-xu_data/stack/oauth-pkce-module branch from 8ad18a8 to 196a2c6 Compare September 8, 2026 20:34
@andy-xu-db
andy-xu-db force-pushed the andy-xu_data/stack/oauth-auth-token-flag branch from 82d4a9d to b66c32d Compare September 8, 2026 20:34
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.

1 participant