Skip to content

[mason] mason login authenticates you (no separate databricks auth login) - #523

Closed
akansal2 wants to merge 2 commits into
databricks:mainfrom
akansal2:mason-login-authenticates
Closed

[mason] mason login authenticates you (no separate databricks auth login)#523
akansal2 wants to merge 2 commits into
databricks:mainfrom
akansal2:mason-login-authenticates

Conversation

@akansal2

@akansal2 akansal2 commented Sep 3, 2026

Copy link
Copy Markdown

What did you change, and why?

Change: mason login now authenticates a profile on its own. If the profile has no usable credentials yet, it runs the Databricks OAuth sign-in for you (by shelling databricks auth login, already a requirement for dev/deploy), then validates and remembers it. An already-authenticated profile is just validated — no browser opens. Adds --host for first-time profile creation.

Why: From the custom-agent bug bash, users had to run two commands — databricks auth login then mason login — and error messages that said "run databricks auth login" were confusing when the fix that worked was mason login (Ann's report). mason login is now the only auth command needed.

Behavior:

  • Try existing credentials first (cheap, no browser); only sign in if that fails, then retry once.
  • Credentials still live in ~/.databrickscfg exactly as the Databricks CLI writes them; Mason only stores the selected profile name in ~/.mason/config.json.
  • README updated to the single-command flow.

Pairs with #522 (clearer auth error messages), whose hints all point at this single mason login.

How do you know it works?

Testing: python -m py_compile on the changed modules (clean). Added unit tests in auth_test.py: mason login runs the sign-in exactly once when the profile has no credentials (and persists the selection), and skips the sign-in entirely when the profile already authenticates. Existing auth_test.py cases are unchanged. Full suite runs in CI. Draft until CI is green.

…gin)

mason login now runs the Databricks OAuth sign-in itself when the profile has no
usable credentials yet — it shells `databricks auth login` (already required for
dev/deploy), then validates and remembers the profile. An already-authenticated
profile is just validated, so no browser opens. Adds --host for first-time profile
creation and updates the README to the single-command flow.

Co-authored-by: Isaac <no-reply@databricks.com>
Users don't need to see the wrapped `databricks auth login ...` invocation; the
hint already tells them what to do (re-run mason login / pass --host).

Co-authored-by: Isaac <no-reply@databricks.com>
@akansal2
akansal2 marked this pull request as ready for review September 3, 2026 16:56
@akansal2

akansal2 commented Sep 3, 2026

Copy link
Copy Markdown
Author

Superseded by #520 ("Make Mason login configure Databricks authentication"), which already landed the same mason login authenticates-you feature on main with a more complete flow (interactive-terminal check + validate→login→revalidate retry). Closing as a duplicate. The only unique piece here was --host support for creating a brand-new profile during login; can be added as a small standalone follow-up if wanted.

@akansal2 akansal2 closed this Sep 3, 2026
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