ASP.NET Core accepts tokens up to five minutes past their `exp` claim because its default token validation parameters allow clock skew leeway. The behavior follows RFC 7519, but with short-lived access tokens it effectively stretches their lifetime and weakens revocation.
Key points
- Default `ClockSkew` is 300 seconds, so a 60-minute token stays valid for 65 minutes.
- JWT libraries in Node.js, Go and Python default to zero leeway out of the box.
- Setting `ClockSkew = TimeSpan.Zero` in `TokenValidationParameters` removes the grace period.
- RFC 7519 sets no fixed duration and leaves the leeway threshold to library authors.
- With 5-10 minute access tokens, the default extends effective lifetime by 50-100%.
- Multi-region or third-party identity providers may warrant a middle ground of 30-60 seconds.
Real-world use
- An API issuing 5-10 minute access tokens where fast revocation matters
- A polyglot setup where a Node.js auth provider feeds Go and ASP.NET Core services
- Multi-region systems or external identity providers where NTP drift causes intermittent failures
This summary was generated by the agent from the original post on DEV Community: #aspnetcore. The full text and all rights belong to its author and publisher. Go to original