Design reliable sign-in on top of a flaky token provider
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Snowflake's system design round, last asked Sep 2025. It tests authentication, reliability and retries.
Clients must get a token from a third-party authorization service before they call your main API. That provider is unreliable: requests fail intermittently, time out, and sometimes come back malformed. Design an end-to-end flow so users can still sign in and call your service reliably, without accepting anything unsafe.
Requirements
- Functional: token acquisition, validation of what the provider returns, caching and refreshing tokens, authorizing every call to the main API.
- Non-functional: high availability of sign-in and API calls despite the provider's failures, low added latency, strict security (never accept a forged or unverified token), containment of failures to one region or tenant.
Clarifying questions
- Is the token a signed JWT that can be verified locally, or opaque and only checkable by calling the provider?
- How long do tokens live, and can they be revoked before expiry?
- What may still work while the provider is down: existing sessions only, or new sign-ins too?
- What error rate and latency does the provider show today, and what are our SLOs?
- Is the client a browser, a mobile app, or another service?
What a strong answer covers
- The request flow with a token broker or gateway between clients and the provider, and the APIs and data model (token cache entries, refresh state, permission snapshots).
- Validating responses strictly: schema, signature, issuer, audience, expiry; quarantining malformed responses instead of retrying them blindly.
- Retries with timeouts, exponential backoff and jitter, retry budgets, circuit breakers, and when request hedging helps or hurts.
- Caching verified tokens and public keys, refreshing ahead of expiry, single-flight refresh to avoid stampedes.
- A degraded mode decided explicitly: extend sessions on cached permissions for a bounded time, which actions stay allowed, and the security trade-off of doing so.
- Idempotency keys for calls retried across a token refresh, rate limiting toward the provider, regional isolation, and observability (provider error rate, refresh failures, cache hit rate, alerts tied to SLOs) with a failure playbook.
Follow-ups
- The provider returns a well-formed but wrongly signed token for a few minutes. What happens in your system?
- The provider is fully down for an hour. What do users experience, minute by minute?
- How do you handle revocation of a token you have cached?
- Add a second provider as a fallback: what changes?
Where it's asked
- Snowflake · System design · Last asked Sep 202560 min · Design discussion
What it tests
authentication · reliability · retries · caching
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
