Frontend Mission · Angular

Mission #002: The Concurrent Token Refresh Bug

Difficulty: SeniorEstimated time: 5 minutes

Skills

AngularRxJSHTTP InterceptorsConcurrencyProduction Debugging

Scenario

Several API requests are sent at the same time. The user's access token has expired, so all of them receive a 401 response.

The application's interceptor starts a token refresh for every failed request, causing multiple refresh requests and inconsistent authentication state.

Your task is to identify the concurrency problem and choose a safer design.