OAuth + JWT: Strava tokens never leave the backend
OAuth · JWT · httpOnlyThe problem
After the OAuth callback, the backend receives the Strava tokens. Forwarding them to the frontend would expose third-party credentials to JavaScript, vulnerable to any XSS attack. The challenge: authenticate the frontend without ever handing it what it shouldn't see.
The solution
Strava tokens are stored in the database at callback time, never exposed to the frontend. The backend issues its own JWTs, set as httpOnly cookies: unreachable from JavaScript. JTI rotation: each refresh revokes the previous token, and any reuse of a revoked token revokes all sessions. Silent refresh via Apollo Link.
