Daily iOS
Security

Token lifetime

Your app keeps the access and refresh tokens in the Keychain and refreshes when it gets a 401. How do you stop duplicate refreshes when several requests get a 401 at the same time?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Put the refresh logic in one actor and share the in-flight refresh Task, so concurrent 401s collapse into a single refresh while the other requests wait for its result and retry once with the new token.

Share a question