trails/apps/journal/app/lib/connected-services
Ullrich Schäfer 6f366293c9
journal: OAuth connect→callback→resume lifecycle as one module
The PKCE verifier cookie, state encoding, redirect-URI construction,
and code exchange were coordinated across three route handlers that
each knew part of the protocol. Two latent bugs lived in the gaps: a
push-initiated re-authorization skipped PKCE entirely (harmless today
only because the sole pusher, Wahoo, is not a PKCE provider), and the
push-resume callback path never cleared the spent verifier cookie.

oauth-flow.server.ts now owns the lifecycle: initiateOAuthFlow builds
the provider redirect (state + verifier cookie, on every entry path),
and completeOAuthFlow consumes the callback — state decode, verifier
recovery, code exchange, connection linking — returning a
discriminated result the route maps to redirects. The three routes are
thin adapters; the next OAuth provider reuses the flow, not the
pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 07:44:04 +02:00
..
credential-adapters Add Komoot import with public (bio verification) and authenticated modes 2026-05-23 10:18:46 +02:00
providers feat(journal): Garmin activity import — provider, webhook pipeline, backfill (§1–5) 2026-06-07 17:47:22 +02:00
fit.ts chore(ts): eliminate the remaining 4 \as any\ casts in production code 2026-05-26 07:11:02 +02:00
index.ts Wahoo capability adapters + caller migration (groups 3-5) 2026-05-08 01:25:33 +02:00
manager.test.ts Schema rename + ConnectedServiceManager foundation (groups 1-2) 2026-05-08 01:14:38 +02:00
manager.ts feat(journal): Garmin activity import — provider, webhook pipeline, backfill (§1–5) 2026-06-07 17:47:22 +02:00
oauth-flow.server.test.ts journal: OAuth connect→callback→resume lifecycle as one module 2026-06-10 07:44:04 +02:00
oauth-flow.server.ts journal: OAuth connect→callback→resume lifecycle as one module 2026-06-10 07:44:04 +02:00
oauth-state.server.ts feat(journal): Garmin activity import — provider, webhook pipeline, backfill (§1–5) 2026-06-07 17:47:22 +02:00
oauth-state.test.ts feat(journal): Garmin activity import — provider, webhook pipeline, backfill (§1–5) 2026-06-07 17:47:22 +02:00
push-action.server.ts journal: branded ownership loading for routes and activities 2026-06-10 02:35:00 +02:00
registry.ts feat(journal): Garmin activity import — provider, webhook pipeline, backfill (§1–5) 2026-06-07 17:47:22 +02:00
types.ts Add Komoot import with public (bio verification) and authenticated modes 2026-05-23 10:18:46 +02:00