← Mon, Nov 23 digest

What we learned operating auth for 1k APIs

read article ↗ hn thread ↗

Operating OAuth for over 1,000 third-party APIs exposes severe provider inconsistencies, undocumented token rotation behaviors, and silent failures requiring custom engineering workarounds.

read it It offers concrete, hard-earned engineering lessons for anyone building systems that integrate with multiple external OAuth providers.

summary

The integration platform Nango shares operational insights gathered after supporting over 1,000 third-party APIs. They detail how subtle provider differences—such as immediate refresh token invalidation, missing expiration timestamps, and error responses masked as HTTP 200s—can silently break authentication. To handle these edge cases, the team implemented distributed locking for token refreshes, per-provider expiration buffers, and custom error-detection heuristics. The article concludes with a practical wishlist for API providers to make authentication more reliable.

key points

  1. Refresh token rotation can turn ordinary code bugs into permanent connection failures if new tokens are not persisted atomically.
  2. Many providers omit standard parameters like expires_in or return HTTP 200 status codes for explicit auth errors, forcing teams to build custom validation heuristics.
  3. Integrating at scale often requires building mock servers or bypassing deficient official documentation entirely.

who should read it

Backend engineers and system architects building applications that integrate with multiple third-party SaaS APIs.

discussion positive

consensus

Commenters deeply sympathize with the operational pain of non-standard OAuth implementations and HTTP 200 error responses, agreeing that integration breakage is an inevitable tax.

pushback

A minority view points out that keeping old refresh tokens alive for convenience sacrifices security protections against replay attacks.

best comment by cryptonector ↗

Even `expires_in` requires care. The token expires in 3600s, but, from when? In the token there will be an `exp` with an absolute value, but `expires_in` in the envelope is relative -- relative to when? Relative to whenever the issuer issued the token, so relative to `iat`/`exp`. But you don't want to have to extract that from the token, and you won't get to if the token is encrypted, so the best you can do is add `expires_in` to now, but it has to be a clock value from before you send the request.

It details the subtle clock-skew and absolute versus relative expiration issues inherent in handling the OAuth expires_in specification.

Generated by an LLM from the article and thread. Check the sources before relying on it.