docs(auth): recommend service account over API key (KLA-407 Slice A)#24
Merged
Merged
Conversation
jrennichjc
approved these changes
Apr 28, 2026
User-feedback ask: API keys shouldn't be the default recommendation;
flip the docs and UX to lead with OAuth client credentials. This is
Slice A — UX/docs only. Slice B (Device Flow) is platform-blocked
(JumpCloud needs to expose /oauth2/device first) and remains tracked
in KLA-407.
Changes:
- internal/cmd/setup.go — wizard menu reordered: option 1 is now
Service Account (OAuth 2.0) labelled "recommended", option 2 is API
Key. Default (Enter) is option 1.
- internal/cmd/setup_test.go — flipped every test's auth-method choice
to match the new menu order. Test intent unchanged; numbers updated.
- internal/cmd/auth.go:
- 'jc auth login' long help leads with --service-account, frames
API key as the legacy/backwards-compat path.
- One-line stderr nudge at the start of the API key flow pointing
operators at --service-account.
- --allow-plaintext flag help text now spells out the security risk
(config file readable to backups, sync clients, etc.) instead of
treating it as a neutral fallback.
- Both plaintext-fallback warnings now name the config path and
nudge the operator to fix their keychain.
- README.md — Authentication Methods section reordered; service
account block leads with "recommended for new deployments". API key
paragraph reframed as "alternative; legacy". Plaintext-storage risk
is now bolded.
- docs/QUICKSTART.md — first-run snippet now mentions service account
recommendation in a comment and shows --service-account first.
No new tests; existing setup test suite covers the menu flow with the
flipped choices. Full suite green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2d35ce1 to
771c522
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.
Summary
Slice A of KLA-407 — the UX/docs flip. Flips the recommendation in
jc setup,jc auth login --help, README, and QUICKSTART so service account (OAuth 2.0) leads and API key is reframed as the legacy/backwards-compat path.Slice B (OAuth Device Flow for human-bound auth) is platform-blocked and stays tracked in KLA-407 — JumpCloud needs to expose
/oauth2/devicebefore we can implement.Why
User feedback: API keys are long-lived bearer secrets that hold tenant-wide admin privilege. They shouldn't be the recommended path even if they remain available. Service accounts (OAuth client credentials) are easier to rotate, revoke, and scope upstream.
What changed
Setup wizard
setup_test.goupdated: every test's auth-method choice flipped to match the new order. Test intent unchanged.jc auth login--service-accountand explains why; API key block is reframed as legacy / backwards-compat.--service-account— visible to anyone runningjc auth logininteractively.--allow-plaintextflag help text now spells out the security risk (config file readable to backups, sync clients, malware) instead of treating it as a neutral fallback.~/.config/jc/config.yaml) and nudge the operator to fix their keychain.Docs
--service-accountfirst.What's NOT in this PR
jc auth loginwithout flags still goes to API key flow. Flipping the actual default would break scripted use; the nudge is sufficient for now.Test plan
go build ./...cleango test ./...— full suite passingsetup_test.go— all test cases flipped correctly; menu choice "1" now exercises Service Account, "2" exercises API Key, empty (Enter) defaults to Service Accountjc auth login --helpreads naturally with the reordered long helpRelated
docs/AUTH.md🤖 Generated with Claude Code
Note
Low Risk
Mostly user-facing docs/help/UX changes, with minimal behavioral impact limited to interactive prompts and stderr messaging.
Overview
Shifts the recommended authentication path to OAuth 2.0 service accounts across README and Quickstart, reframing API keys as legacy/backwards-compatible and adding clearer security warnings around plaintext credential storage.
In the CLI,
jc setupnow lists Service Account as option 1 (default on Enter) and API key as option 2, with tests updated accordingly, andjc auth loginhelp text plus warnings now more strongly steer users toward--service-accountand explicitly call out plaintext/keychain failure risks (including printing the config path).Reviewed by Cursor Bugbot for commit 771c522. Bugbot is set up for automated code reviews on this repo. Configure here.