BC5 OAuth: resource-first discovery, device-flow login, RFC 8707 resource echo

Merged
JE
4mo ago
+1492-999

Adopts the SDK's BC5 OAuth stack end to end: resource-first discovery (RFC 9728 + 8414), RFC 8628 device-flow login as the pre-registered public basecamp-cli client, and the RFC 8707 multi-account refresh contract.

Why the resource echo matters: basecamp-cli is a trusted client in bc3's registry, so a device approval records an identity-wide grant and mints a multi-account refresh token. bc3's refresh grant hard-requires the RFC 8707 resource parameter for those (400 invalid_request without it) — without persisting and echoing it, every device login dies at its first token expiry (~1h). Credentials gain a resource field (auth + mirrored sdk store); device login persists token.Resource; refresh echoes it and preserves it when the refresh response omits it. An end-to-end test drives login → stored resource → forced refresh → form echo → binding surviving a resource-less rotation.

Gating: DRAFT until basecamp-sdk#478 (resource indicator + 429 poll contract, stacked on #376/#370) merges — the SDK pin tracks the #478 branch head (see go.mod + internal/version/sdk-provenance.json for the current pseudo-version — re-pinned on every go/ change); it moves to the merged SHA before this lands. No SDK release required first, per current pseudo-version practice.

Also restacked onto main (was 36 behind): reconciled the go.mod/go.sum/provenance conflict to main's newer pin, dropped stale go.sum entries the auto-merge left, and absorbed SDK API drift since the branch's old 7207f742 snapshot (VerificationURIComplete/RegistrationEndpoint → *string).


Summary by cubic

Adopts the BC5 OAuth stack end to end: resource‑first discovery, automatic RFC 8628 device‑flow login as public basecamp-cli, and RFC 8707 resource echo, with stricter endpoint validation and provider‑neutral flags. Updates the SDK to github.com/basecamp/basecamp-sdk/go@v0.10.1-0.20260729233651-9480aa4c84b8 (merged stack: device flow, resource indicators, hardened transport/parse/refresh).

  • New Features

    • Resource‑first discovery (RFC 9728 → 8414) from a canonicalized resource origin; falls back to Launchpad only on “no AS advertised” or “resource discovery failed”.
    • Device‑flow login as basecamp-cli with validated verification URLs (HTTPS, localhost case‑insensitive, ports 1–65535), sanitized display, and early abort on bad data; --device-code forces headless; --scope help notes Launchpad ignores it.
    • Persist and echo the RFC 8707 resource across refreshes for multi‑account tokens; mirrored in the SDK store; legacy “bc3” refreshes surface a re‑authenticate error.
    • Fix the authorization‑info URL to use the canonical resource origin.
  • Migration

    • Removed the BC3 dev‑only DCR/PKCE flow; client.json is obsolete and safe to delete.
    • Stored “bc3” credentials won’t refresh; re‑authenticate to migrate.