Refresh token rotation

Issuing a new refresh token every time one is used and invalidating the old one. Consuming the old token with an atomic GETDEL means two requests racing with the same token cannot both succeed, and a replayed token is rejected.

Minimal example

text
GETDEL refresh:{old}   -> user_id or nil
SET refresh:{new} {user_id} EX 2592000

Learn this concept

Lesson 3.2 · JWT and refresh token rotation

Used in exercises

Exercise 3.3 · POST /v1/auth/*: signup, login and refresh Exercise 3.22 · POST /v1/auth/refresh: detect token reuse
Prerequisite conceptsRefresh token