System Design · Middle · Question 48 of 75

How do you handle an access token expiring while the user is working?

Explanation

Several parallel requests may get 401 at the same time - the refresh must run once (a shared promise), while the other requests wait for it and are retried. If the refresh fails, log out while preserving drafts.

Further reading

Problem with a question

System Design · Middle · question 48

Test yourself

Take the System Design · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz