Performance: Refresh token pattern
MEDIUM IMPACT
This pattern affects the responsiveness and load on the backend server during user authentication refresh cycles.
Use silent background refresh of access tokens before expiry with asynchronous calls, allowing user actions to continue.
On every API request, the client sends the refresh token to get a new access token synchronously before proceeding.
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous token refresh on every request | Minimal | 0 | 0 | [X] Bad |
| Asynchronous background token refresh | Minimal | 0 | 0 | [OK] Good |
| Storing refresh token in localStorage | N/A | N/A | N/A | [X] Bad |
| Storing refresh token in HttpOnly cookie | N/A | N/A | N/A | [OK] Good |