The two tokens follow a simple lifecycle: a short-lived access token authorizes each API call, and a long-lived refresh token silently mints new access tokens when they expire — so the user stays logged in without re-entering credentials.
The flow
┌─────────┐ login ( pass) ┌────────────┐
│ Client │ ────────────────────────▶ │ Auth server│
│ │ ◀──── access refresh ─── │ │
└─────────┘ └────────────┘
│ API : : Bearer access
▼
┌────────────┐ verify signature ( DB lookup)
│ Resource │ ──── OK ────▶ (access still valid)
│ API │ ──── ───────▶ (access expired)
└────────────┘
│ : POST token { refresh }
▼
┌────────────┐ verify rotate
│ Auth server│ ──── access ( refresh) ────▶ retry the
└────────────┘
