OAuth 2.0 token endpoint latency that only appears under concurrent requests
0 reputation · 18 Oct 2025, 08:30 UTC
0 reputation · 18 Oct 2025, 08:30 UTC
An OAuth 2.0 authorization server implementing the Authorization Code Grant with PKCE shows acceptable token endpoint latency for sequential requests, but latency rises noticeably once multiple clients exchange codes or refresh tokens in parallel. Single-request benchmarks look normal, so the slowdown only surfaces under concurrency.
RFC 6749 requires authorization codes to be short-lived and single-use, and OAuth 2.0 Security Best Current Practice recommends refresh token rotation, but neither mandates how an implementation achieves atomicity. Many servers serialize token issuance per client or user, or take locks when invalidating a used code or rotated refresh token. Token introspection (RFC 7662) can add a backend lookup per request. Latency could also come from outside OAuth entirely, such as database contention or JWKS fetching, so the token endpoint needs to be isolated before attributing the cause.
Assume a current mainstream authorization server version; exact locking, caching, and rotation grace-window behavior is implementation specific and should be verified against the server's documentation.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.