A web developer looking to learn and build the most breathtaking projects. Interested in all things Javascript/Typescript. Hopping from one framework to another.
Nice walkthrough. One case worth adding: multiple tabs. The promise queue only dedupes inside one tab, so with refresh token rotation two tabs can refresh at once and trigger reuse detection on the backend. Wrapping the refresh in navigator.locks.request() and syncing the new token with BroadcastChannel fixes it.
mohammad garmabi
Nice walkthrough. One case worth adding: multiple tabs. The promise queue only dedupes inside one tab, so with refresh token rotation two tabs can refresh at once and trigger reuse detection on the backend. Wrapping the refresh in navigator.locks.request() and syncing the new token with BroadcastChannel fixes it.