I've spent about four and a half years building ASP.NET Core APIs, and JWT auth is still the place I see the most "it works in Postman" security holes. Short-lived access tokens are easy. Refresh tokens that survive a phone reboot and a stolen laptop are harder.
This is the pattern I ship: a short JWT access token, an opaque refresh token stored as a SHA-256 hash, rotation on every refresh, and family-wide revocation when a rotated token shows up again. The code below comes from a .NET 10 / EF Core starter I maintain. It also runs on .NET 8 with almost no changes.
What each token is for
Token Lifetime I use Form Stored how
Access 15 minutes Signed JWT Nowhere (stateless)
Refresh 7 days Opaque random bytes SHA-256 hash in SQL
The access token is what every [Authorize] endpoint checks. The refresh token is only sent to /api/auth/refresh (and revoke).…