Support custom OAuth redirect_uri by jeremy · Pull Request #186 · basecamp/basecamp-cli

added 2 commits

March 3, 2026 14:28
Users with their own OAuth client credentials registered on Launchpad
need the CLI's redirect_uri to match their app's registered callback.
The CLI previously hardcoded http://127.0.0.1:8976/callback with no
way to override it.

Add resolveOAuthCallback() with precedence chain:
  LoginOptions.RedirectURI > BASECAMP_OAUTH_REDIRECT_URI env var >
  CallbackAddr-derived > hardcoded default

Validate all redirect URIs (including default) against RFC 8252
loopback rules: http scheme, loopback host, explicit port, no
userinfo/query/fragment.

Rename credential env vars to BASECAMP_OAUTH_CLIENT_ID/SECRET with
strict pairing (both required when either is set).

BC3 DCR clients registered with a custom redirect URI are not
persisted to client.json, preventing stale credentials on subsequent
runs without the override.

Closes #183

Copilot AI review requested due to automatic review settings

March 3, 2026 22:28

@jeremy

…est isolation

- Remove `customRedirect bool` parameter from `registerBC3Client`; derive
  it from `opts.RedirectURI != defaultRedirectURI` inside the function
- Add `XDG_CONFIG_HOME` override in `TestRegisterBC3Client_UsesResolvedRedirectURI`
  to prevent writing to the developer's real config dir
- Use full env var names in README sentence

@jeremy jeremy deleted the oauth-redirect-uri branch

March 4, 2026 00:26