Skip to content

docs(auth): recommend service account over API key (KLA-407 Slice A)#24

Merged
jklaassenjc merged 1 commit into
mainfrom
juergen/kla-407-oauth-recommendation
Apr 28, 2026
Merged

docs(auth): recommend service account over API key (KLA-407 Slice A)#24
jklaassenjc merged 1 commit into
mainfrom
juergen/kla-407-oauth-recommendation

Conversation

@jklaassenjc
Copy link
Copy Markdown
Collaborator

@jklaassenjc jklaassenjc commented Apr 28, 2026

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/device before 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

  • Menu reordered: option 1 is Service Account (OAuth 2.0) — recommended, option 2 is API Key. Default (Enter) is option 1.
  • Tests in setup_test.go updated: every test's auth-method choice flipped to match the new order. Test intent unchanged.

jc auth login

  • Long help leads with --service-account and explains why; API key block is reframed as legacy / backwards-compat.
  • One-line stderr nudge at the top of the API key flow pointing operators at --service-account — visible to anyone running jc auth login interactively.
  • --allow-plaintext flag help text now spells out the security risk (config file readable to backups, sync clients, malware) instead of treating it as a neutral fallback.
  • Both plaintext-fallback warnings now name the config path explicitly (~/.config/jc/config.yaml) and nudge the operator to fix their keychain.

Docs

  • 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 now bolded.
  • docs/QUICKSTART.md — first-run snippet mentions service account recommendation and shows --service-account first.

What's NOT in this PR

  • OAuth Device Flow — Slice B; blocked on JumpCloud platform (admin OAuth device endpoint isn't exposed today). Tracked in KLA-407.
  • Default flip in CLI behaviorjc auth login without flags still goes to API key flow. Flipping the actual default would break scripted use; the nudge is sufficient for now.
  • AUTH.md link from README — already added in PR docs(auth): add docs/AUTH.md — single source of truth (KLA-410) #21 (KLA-410); avoiding a merge conflict by leaving it to that PR.

Test plan

  • go build ./... clean
  • go test ./... — full suite passing
  • setup_test.go — all test cases flipped correctly; menu choice "1" now exercises Service Account, "2" exercises API Key, empty (Enter) defaults to Service Account
  • jc auth login --help reads naturally with the reordered long help

Related

🤖 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 setup now lists Service Account as option 1 (default on Enter) and API key as option 2, with tests updated accordingly, and jc auth login help text plus warnings now more strongly steer users toward --service-account and 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.

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>
@jklaassenjc jklaassenjc force-pushed the juergen/kla-407-oauth-recommendation branch from 2d35ce1 to 771c522 Compare April 28, 2026 19:18
@jklaassenjc jklaassenjc merged commit 60e4678 into main Apr 28, 2026
6 of 7 checks passed
@jklaassenjc jklaassenjc deleted the juergen/kla-407-oauth-recommendation branch April 28, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants