· via Hacker News – Front Page (native)
Nango's OAuth postmortem: how a two-hour bug and token rotation forced mass reauthorization
Nango details hard-won lessons from operating OAuth for more than 1,000 APIs, including a two-hour bug that permanently destroyed rotated refresh tokens and forced users to reauthorize.

A two-hour bug with permanent consequences
In May 2025, Nango merged a pull request with a subtle flaw: a conditional that never fired meant refreshed credentials were never written to the database. The team caught and reverted the change in just under two hours, according to a postmortem on the company's blog that reached the front page of Hacker News. Nango is an open-source project that web applications and agents embed to integrate with third-party APIs; since the incident it has grown from roughly 400 supported APIs to more than 1,000.
The fix was not fast enough. During the window, Nango's scheduled jobs refreshed and then discarded access and refresh tokens for hundreds of connections. For most APIs the old refresh token still worked, so the next scheduled run repaired the damage. Then the team discovered how many providers rotate refresh tokens.
Airtable and Atlassian invalidate the old refresh token as soon as a replacement is issued, and Salesforce and Slack can do the same when rotation is enabled for the OAuth app, Nango writes. There was no way to recover those credentials. For every affected connection, Nango's customers had to send their end users back through the consent screen.
Persist the new token before anything else can fail
The incident reshaped operations. A replacement token is now saved before any other step in the refresh flow runs, the persistence path has its own regression tests, and unusual platform-level refresh activity immediately pages the on-call engineer.
Rotation policies differ sharply between providers. Airtable can answer a stale token or the wrong client credentials with a 400 or 401 and then revoke the user's entire authorization for the app; retrying the same refresh after a short documented grace period triggers revocation as well. Airtable also kills the old access token the moment a refresh succeeds, which can fail a long-running job mid-flight. Xero sits at the opposite end, allowing retries with the previous refresh token for up to 30 minutes.
Even refreshing early can be wrong. Exact Online's access tokens last 10 minutes, and its token endpoint rejects any refresh attempted more than 30 seconds before expiry. Nango's blanket rule of refreshing 15 minutes early meant every refresh fell outside the allowed window, forcing per-provider expiration buffers. Refreshes are also serialized per connection behind a distributed lock.
Expiry information cannot be trusted
RFC 6749, the OAuth 2.0 specification, makes the expires_in field optional, which Nango identifies as a recurring and quiet source of breakage. Zendesk introduced expiring access tokens but includes expires_in in the response only when requested; without it, tokens still expire under a default policy. Nango discovered the change only after refresh tokens lapsed and connections failed.
Salesforce returns no expiry information at all. The documented approach is a separate introspection endpoint, but in June 2024, Nango says, that endpoint began intermittently returning unsupported_token_type for some tokens. Nango refreshed anyway, and the replacement tokens introspected normally; the cause was never explained.
Refresh token lifetimes are just as uneven. NetSuite's expire after seven days and force full re-consent, which is why many teams fall back on its token-based authentication. Google's last indefinitely unless documented conditions apply, such as an app being in testing status, six months of disuse, or a user holding more than 100 live refresh tokens for the client. Nango now refreshes stale credentials on a schedule so that inactivity alone cannot kill them.
When auth errors hide inside 200 responses
Authentication failures frequently arrive dressed as success. Zoho CRM's token endpoint returns HTTP 200 with the error in the body. Workday and Dayforce return empty data rather than an error when a permission policy is missing. One SOAP-based API Nango supports returns 200 for everything, wrong passwords included, and LastPass embeds failures as plain text — Nango's credential check literally searches responses for the string "Authorization Error". Nango responded with per-provider heuristics: 276 of the roughly 935 providers in its registry declare an authenticated endpoint that can be probed to confirm credentials still work.
Breaking changes arrive unannounced
Roughly 16% of commits to Nango's provider configuration are fixes, and no dependable feed announces provider auth changes; problems surface as failed flows or customer reports. Figma notified developers by email that credentials were moving from the request body to a Basic Authorization header and that its OAuth host was changing. Shopify altered how offline tokens are issued, causing apps to start receiving expiring tokens where they previously received permanent ones.
Occasionally Nango works around the provider instead: it built a mock server from documented responses to test Salesforce Data Cloud's chained token exchanges, extended its proxy for LastPass's single-URL API, and documented an Asana OAuth fix found in a support forum rather than official documentation.
Why it matters
Nango's core observation is that OAuth may be a standard, but its implementations diverge wildly, and the differences often stay undocumented until they hurt in production. For teams running API integrations, the postmortem offers concrete practices: save the new token first, serialize refreshes, probe credentials per provider, and expect auth behavior to change without notice. Nango closes with ten requests aimed at API builders — the first being to always return expires_in.
- #oauth
- #api-integrations
- #postmortem
- #open-source
- #token-rotation