Skip to content

Add host discovery to login.databricks.com flow - #4829

Merged
simonfaltum merged 2 commits into
mainfrom
simonfaltum/discovery-login-host-discovery
Mar 26, 2026
Merged

Add host discovery to login.databricks.com flow#4829
simonfaltum merged 2 commits into
mainfrom
simonfaltum/discovery-login-host-discovery

Conversation

@simonfaltum

Copy link
Copy Markdown
Member

Why

The discovery login flow via login.databricks.com (PR #4702) is a separate code path from the regular --host login. After #4809 added SPOG host detection via .well-known/databricks-config to the regular login path, the discovery flow was missing this behavior. Profiles created via login.databricks.com for SPOG hosts had no account_id and no discovery metadata, which breaks re-authentication (because ToOAuthArgument() needs account_id to route to unified OAuth).

Changes

Before:discoveryLogin() only used token introspection for workspace_id and deliberately skipped saving account_id.

Now: After getting the host from login.databricks.com, discoveryLogin() calls runHostDiscovery() on the discovered host to populate account_id, workspace_id, and DiscoveryURL from .well-known/databricks-config. Token introspection is kept as a fallback for hosts where discovery is unavailable (e.g. classic workspace hosts). account_id is now saved to the profile.

Note: This is not the full SPOG story for discovery login. Most SPOG workspaces will need additional handling during the login.databricks.com flow (e.g. workspace selection after discovery detects a multi-workspace account). A follow-up PR will address this.

Test plan

  • New test: discovery login with SPOG host (mock .well-known/databricks-config) verifies account_id and workspace_id come from discovery
  • New test: discovery login where host discovery fails verifies fallback to introspection
  • Updated existing tests to assert account_id is now saved
  • All go test ./cmd/auth/... ./libs/auth/... pass
  • make checks passes

This pull request was AI-assisted by Isaac.

Base automatically changed from simonfaltum/spog-discovery-login to mainMarch 26, 2026 15:38
The discovery login flow via login.databricks.com now calls
runHostDiscovery() on the discovered host to populate account_id,
workspace_id, and DiscoveryURL from .well-known/databricks-config.
This ensures profiles created via login.databricks.com have the same
SPOG metadata as profiles created via the regular --host login path.
Previously, the discovery flow relied solely on token introspection
for workspace_id and deliberately skipped saving account_id. With the
SPOG discovery changes now in place, account_id can be safely saved
to profiles. Token introspection remains as a fallback when host
metadata discovery is unavailable (e.g. classic workspace hosts).
Co-authored-by: Isaac
@simonfaltum
simonfaltumforce-pushed the simonfaltum/discovery-login-host-discovery branch from 3418b86 to f92e226CompareMarch 26, 2026 22:01
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Mar 26, 2026

Copy link
Copy Markdown
Collaborator

Commit: ca5ac25

Run: 23621038275

Env💚​RECOVERED🙈​SKIP✅​pass🙈​skipTime
💚​aws linux7102708076:28
💚​aws windows7102728055:33
💚​aws-ucws linux7103667236:42
💚​aws-ucws windows7103687216:23
💚​azure linux1122738057:55
💚​azure windows1122758035:27
💚​azure-ucws linux1123717196:37
💚​azure-ucws windows1123737177:00
💚​gcp linux1122698085:35
💚​gcp windows1122718065:01
17 interesting tests: 10 SKIP, 7 RECOVERED
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp windows
💚​TestAccept💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R💚​R
🙈​TestAccept/bundle/resources/permissions🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions💚​R💚​R💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions💚​R💚​R💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R💚​R💚​R
🙈​TestAccept/bundle/resources/postgres_branches/basic🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_branches/recreate🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_branches/update_protected🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_branches/without_branch_id🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_endpoints/basic🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_endpoints/recreate🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/postgres_projects/update_display_name🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/bundle/resources/synced_database_tables/basic🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🙈​TestAccept/ssh/connection🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
Top 20 slowest tests (at least 2 minutes):
durationenvtestname
5:12azure linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:52azure-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:43gcp windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:38azure-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:38gcp linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:17aws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:15gcp windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:14gcp linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
3:12azure-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
3:07aws-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:59aws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:49azure windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:48azure-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:47aws-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:45aws-ucws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform
2:44aws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:42aws-ucws linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:41aws windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:40azure windowsTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=direct
2:15azure linuxTestAccept/bundle/resources/apps/inline_config/DATABRICKS_BUNDLE_ENGINE=terraform

…ks.com
The login.databricks.com flow now calls runHostDiscovery() on the
discovered host, which populates workspace_id from .well-known and
account_id from introspection as a fallback. Update the expected
output to reflect both fields being saved to the profile.
Co-authored-by: Isaac
@simonfaltum
simonfaltum added this pull request to the merge queueMar 26, 2026
Merged via the queue into main with commit 10c3bf9Mar 26, 2026
19 checks passed
@simonfaltum
simonfaltum deleted the simonfaltum/discovery-login-host-discovery branch March 26, 2026 23:09
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Commit: 10c3bf9

Run: 23622543693

Env❌​FAIL🟨​KNOWN🔄​flaky💚​RECOVERED🙈​SKIP✅​pass🙈​skipTime
❌​aws linux3161050076051:30
❌​aws windows3161047276852:22
❌​aws-ucws linux6325279460589:02
❌​aws-ucws windows65619275561681:32
❌​azure linux311250375846:35
❌​azure windows3121247376647:49
❌​azure-ucws linux71231177360880:29
❌​azure-ucws windows71231173661967:34
❌​gcp linux311248576652:03
❌​gcp windows311245777450:32
44 interesting tests: 19 RECOVERED, 10 FAIL, 8 flaky, 5 KNOWN, 2 SKIP
Test Nameaws linuxaws windowsaws-ucws linuxaws-ucws windowsazure linuxazure windowsazure-ucws linuxazure-ucws windowsgcp linuxgcp windows
🟨​TestAccept🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K🟨​K
❌​TestAccept/bundle/apps/job_permissions❌​F❌​F❌​F❌​F❌​F❌​F🔄​f🔄​f❌​F❌​F
❌​TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct❌​F❌​F❌​F❌​F❌​F❌​F🔄​f✅​p❌​F❌​F
❌​TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform❌​F❌​F❌​F❌​F❌​F❌​F✅​p🔄​f❌​F❌​F
❌​TestAccept/bundle/resources/grants/schemas/duplicate_principals🙈​s🙈​s✅​p✅​p🙈​s🙈​s❌​F❌​F🙈​s🙈​s
❌​TestAccept/bundle/resources/grants/schemas/duplicate_principals/DATABRICKS_BUNDLE_ENGINE=direct✅​p✅​p❌​F❌​F
❌​TestAccept/bundle/resources/grants/schemas/out_of_band_principal🙈​s🙈​s✅​p✅​p🙈​s🙈​s❌​F❌​F🙈​s🙈​s
❌​TestAccept/bundle/resources/grants/schemas/out_of_band_principal/DATABRICKS_BUNDLE_ENGINE=direct✅​p✅​p❌​F❌​F
❌​TestAccept/bundle/resources/grants/schemas/remove_principal🙈​s🙈​s❌​F❌​F🙈​s🙈​s❌​F❌​F🙈​s🙈​s
❌​TestAccept/bundle/resources/grants/schemas/remove_principal/DATABRICKS_BUNDLE_ENGINE=direct❌​F❌​F❌​F❌​F
❌​TestAccept/bundle/resources/grants/schemas/remove_principal/DATABRICKS_BUNDLE_ENGINE=terraform❌​F❌​F❌​F❌​F
🙈​TestAccept/bundle/resources/permissions🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions💚​R💚​R💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions💚​R💚​R💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R💚​R💚​R
🔄​TestAccept/bundle/resources/postgres_branches/basic🙈​S🙈​S💚​R🔄​f🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🔄​TestAccept/bundle/resources/postgres_branches/basic/DATABRICKS_BUNDLE_ENGINE=direct💚​R🔄​f
💚​TestAccept/bundle/resources/postgres_branches/basic/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R
🔄​TestAccept/bundle/resources/postgres_branches/recreate🙈​S🙈​S💚​R🔄​f🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🔄​TestAccept/bundle/resources/postgres_branches/recreate/DATABRICKS_BUNDLE_ENGINE=direct💚​R🔄​f
💚​TestAccept/bundle/resources/postgres_branches/recreate/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R
💚​TestAccept/bundle/resources/postgres_branches/update_protected🙈​S🙈​S💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/postgres_branches/update_protected/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R
💚​TestAccept/bundle/resources/postgres_branches/update_protected/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R
💚​TestAccept/bundle/resources/postgres_branches/without_branch_id🙈​S🙈​S💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/postgres_branches/without_branch_id/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R
💚​TestAccept/bundle/resources/postgres_branches/without_branch_id/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R
🟨​TestAccept/bundle/resources/postgres_endpoints/basic🙈​S🙈​S💚​R🟨​K🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🟨​TestAccept/bundle/resources/postgres_endpoints/basic/DATABRICKS_BUNDLE_ENGINE=terraform💚​R🟨​K
💚​TestAccept/bundle/resources/postgres_endpoints/recreate🙈​S🙈​S💚​R💚​R🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
💚​TestAccept/bundle/resources/postgres_endpoints/recreate/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R
🔄​TestAccept/bundle/resources/postgres_projects/recreate🙈​s🙈​s✅​p🔄​f🙈​s🙈​s🙈​s🙈​s🙈​s🙈​s
🔄​TestAccept/bundle/resources/postgres_projects/recreate/DATABRICKS_BUNDLE_ENGINE=direct✅​p🔄​f
🟨​TestAccept/bundle/resources/postgres_projects/update_display_name🙈​S🙈​S🟨​K🟨​K🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
🟨​TestAccept/bundle/resources/postgres_projects/update_display_name/DATABRICKS_BUNDLE_ENGINE=terraform🟨​K🟨​K
💚​TestAccept/bundle/resources/synced_database_tables/basic🙈​S🙈​S💚​R💚​R🙈​S🙈​S💚​R💚​R🙈​S🙈​S
💚​TestAccept/bundle/resources/synced_database_tables/basic/DATABRICKS_BUNDLE_ENGINE=direct💚​R💚​R💚​R💚​R
💚​TestAccept/bundle/resources/synced_database_tables/basic/DATABRICKS_BUNDLE_ENGINE=terraform💚​R💚​R💚​R💚​R
🔄​TestAccept/bundle/templates/default-python/integration_classic✅​p✅​p✅​p✅​p✅​p🔄​f✅​p✅​p✅​p✅​p
🔄​TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.13✅​p✅​p✅​p✅​p✅​p🔄​f✅​p✅​p✅​p✅​p
🙈​TestAccept/ssh/connection🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S🙈​S
Top 50 slowest tests (at least 2 minutes):
durationenvtestname
15:09gcp windowsTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=SINGLE_USER
12:34aws-ucws linuxTestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=terraform
12:29aws-ucws windowsTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
11:00aws-ucws linuxTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
10:59aws-ucws linuxTestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=direct
10:54aws windowsTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
9:36aws-ucws windowsTestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=terraform
9:36azure-ucws windowsTestAccept/bundle/run/app-with-job/DATABRICKS_BUNDLE_ENGINE=terraform
9:22aws-ucws linuxTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
9:10gcp windowsTestAccept/bundle/integration_whl/interactive_cluster/DATABRICKS_BUNDLE_ENGINE=terraform
9:08azure windowsTestAccept/bundle/run/app-with-job/DATABRICKS_BUNDLE_ENGINE=direct
8:58gcp windowsTestAccept/bundle/integration_whl/interactive_cluster/DATABRICKS_BUNDLE_ENGINE=direct
8:55aws windowsTestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=terraform
8:39gcp linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=USER_ISOLATION
8:35gcp linuxTestAccept/bundle/integration_whl/interactive_cluster/DATABRICKS_BUNDLE_ENGINE=direct
8:32azure-ucws windowsTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=SINGLE_USER
8:26gcp linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
8:20gcp linuxTestAccept/bundle/integration_whl/interactive_cluster/DATABRICKS_BUNDLE_ENGINE=terraform
8:14gcp windowsTestAccept/bundle/integration_whl/custom_params/DATABRICKS_BUNDLE_ENGINE=direct
8:10gcp linuxTestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=direct
7:58gcp windowsTestAccept/bundle/run/app-with-job/DATABRICKS_BUNDLE_ENGINE=direct
7:55aws linuxTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
7:51aws linuxTestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_15.4_LTS
7:47gcp linuxTestAccept/bundle/run/app-with-job/DATABRICKS_BUNDLE_ENGINE=terraform
7:44aws windowsTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
7:43azure-ucws linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
7:41gcp windowsTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
7:40aws-ucws windowsTestAccept/bundle/resources/model_serving_endpoints/running-endpoint/DATABRICKS_BUNDLE_ENGINE=terraform
7:38gcp windowsTestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=direct
7:38aws-ucws linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
7:35aws-ucws windowsTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
7:34aws-ucws windowsTestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_13.3_LTS
7:33gcp linuxTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
7:32gcp windowsTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=USER_ISOLATION
7:30aws-ucws windowsTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=USER_ISOLATION
7:27gcp windowsTestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_15.4_LTS
7:25gcp windowsTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
7:24gcp windowsTestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_14.3_LTS
7:24gcp linuxTestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_14.3_LTS
7:23gcp linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=SINGLE_USER
7:18aws windowsTestAccept/bundle/integration_whl/interactive_single_user/DATABRICKS_BUNDLE_ENGINE=direct
7:16gcp linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=SINGLE_USER
7:15gcp linuxTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=direct
7:15gcp linuxTestAccept/bundle/resources/clusters/run/spark_python_task/DATABRICKS_BUNDLE_ENGINE=terraform
7:11aws-ucws linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=direct/DATA_SECURITY_MODE=USER_ISOLATION
7:10aws linuxTestAccept/bundle/integration_whl/base/DATABRICKS_BUNDLE_ENGINE=terraform
7:09aws linuxTestAccept/bundle/integration_whl/interactive_cluster_dynamic_version/DATABRICKS_BUNDLE_ENGINE=terraform/DATA_SECURITY_MODE=SINGLE_USER
7:09aws linuxTestSparkJarTaskDeployAndRunOnWorkspace/Databricks_Runtime_14.3_LTS
7:06azure-ucws windowsTestSparkJarTaskDeployAndRunOnVolumes/Databricks_Runtime_14.3_LTS
7:05gcp windowsTestAccept/bundle/run/app-with-job/DATABRICKS_BUNDLE_ENGINE=terraform

denik pushed a commit that referenced this pull request May 20, 2026
## Why
The discovery login flow via `login.databricks.com` (PR #4702) is a
separate code path from the regular `--host` login. After #4809 added
SPOG host detection via `.well-known/databricks-config` to the regular
login path, the discovery flow was missing this behavior. Profiles
created via `login.databricks.com` for SPOG hosts had no `account_id`
and no discovery metadata, which breaks re-authentication (because
`ToOAuthArgument()` needs `account_id` to route to unified OAuth).
## Changes
**Before:** `discoveryLogin()` only used token introspection for
`workspace_id` and deliberately skipped saving `account_id`.
**Now:** After getting the host from `login.databricks.com`,
`discoveryLogin()` calls `runHostDiscovery()` on the discovered host to
populate `account_id`, `workspace_id`, and `DiscoveryURL` from
`.well-known/databricks-config`. Token introspection is kept as a
fallback for hosts where discovery is unavailable (e.g. classic
workspace hosts). `account_id` is now saved to the profile.
**Note:** This is not the full SPOG story for discovery login. Most SPOG
workspaces will need additional handling during the login.databricks.com
flow (e.g. workspace selection after discovery detects a multi-workspace
account). A follow-up PR will address this.
## Test plan
- New test: discovery login with SPOG host (mock
`.well-known/databricks-config`) verifies `account_id` and
`workspace_id` come from discovery
- New test: discovery login where host discovery fails verifies fallback
to introspection
- Updated existing tests to assert `account_id` is now saved
- All `go test ./cmd/auth/... ./libs/auth/...` pass
- `make checks` passes
This pull request was AI-assisted by Isaac.
Sign up for freeto 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.

3 participants

@simonfaltum@eng-dev-ecosystem-bot@hectorcast-db