intermediateRefresh Tokens & Session Lifecycle
Why use a short-lived access token plus a separate long-lived refresh token instead of one long-lived token?
A short access token (minutes) limits the damage window if it's ever stolen — it expires quickly regardless. The refresh token lives longer but is only ever sent to a single dedicated token-refresh endpoint (never to regular API endpoints), so it's exposed to far fewer network paths, and it can be revoked server-side (stored, rotated, or blacklisted) unlike a stateless access token.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response