OAuth & Authentication

OAuth Error Monitoring: How to Keep SaaS Connections Healthy

How to detect broken OAuth connections early, tell the right person, and spot provider-wide problems before customers do.

3 min read
On this page
  1. Why OAuth connections fail
  2. What to record
  3. Classify, then act
  4. Notifying users
  5. Monitoring for your team
  6. Proactive checks
  7. Recovery
  8. Where Pathfix fits
  9. Frequently asked questions

OAuth connections break more often than most teams expect, and usually silently. A customer revokes access while tidying their account settings. An administrator removes your app. A refresh token expires after months of inactivity. Nothing in your product changes until a sync stops working and the customer notices before you do.

Error monitoring for OAuth connections is about finding those failures early, understanding why they happened, and getting the right person to fix them.

Why OAuth connections fail#

CauseTypical signalFixable by retrying?
Access token expired401 from the APIYes, after refreshing
Refresh token expired or revokedinvalid_grant from the token endpointNo, user must reconnect
User revoked accessinvalid_grant or 401 after refreshNo
App removed by an administratorAuthorization errors for every user in that organizationNo, admin must re-approve
Missing scope403 with an insufficient scope errorNo, needs reconnect with more scopes
Provider outage5xx or timeoutsYes, later
Rate limit429Yes, after backing off
Provider configuration changeNew or unusual errors across many connectionsNo, needs engineering

The most important monitoring decision is separating errors that will fix themselves from errors that need a person.

What to record#

For every failed token refresh or API call, record:

  • Connection ID, tenant and user.
  • Provider.
  • Operation: refresh or API request, and which endpoint.
  • HTTP status and the provider's error code and description.
  • Timestamp.
  • Whether it was retried and the outcome.

Don't record the token itself or full request headers.

Classify, then act#

Map provider errors to a small set of internal states:

  • Transient. Retry with backoff. Alert only if it persists.
  • Needs reauthorization. Mark the connection, stop retrying, notify the user.
  • Needs admin action. Notify the customer's admin, if you know who that is.
  • Needs engineering. Alert your team.

This mapping is provider-specific. Keep it in configuration and update it as you learn how each provider reports problems.

AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTpmNTQ1MGVmMS1kMGM1LTQ2ODYtYjlhOC00ZmY4YmQwOGFjYWUAAAADl2p1bWIAAAApanVtZGM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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQCIUg4MMQLPkCILqGpIAUXylFCITMmpUTn4R1BjglS+I634cSy0/6BY+JoRLL7Uz1RNY9OuJDEhTKM5uQXyo2M0=OAuth token lifecycleConnected, access token valid, token expires, refresh requested, new token issued, connected again. If the refresh is rejected, the connection branches to refresh rejected and then reauthorization required.ConnectedAccess tokenvalidTokenexpiresRefreshrequestedNew tokenissuedConnectedif rejectedRefreshrejectedReauthorization required
Refresh failures are the earliest warning that a connection needs the user, not another retry.

Notifying users#

When a connection needs reauthorization, tell the person who can fix it:

  • In the product, next to the integration, with a clear "Reconnect" button.
  • By email or notification, for integrations that run in the background where the user might not see an in-app banner.

Good messages say what's broken, what effect it has ("New deals are no longer syncing to your dashboard"), and exactly what to do. Avoid raw provider error text.

Rate-limit notifications. A connection that fails every five minutes shouldn't send an email every five minutes.

Monitoring for your team#

Individual failures are the customer's problem to fix. Patterns are yours.

Track:

  • Refresh success rate per provider.
  • Connections entering "needs reauthorization" per provider per day.
  • API error rates by status code and provider.
  • Connections that haven't successfully been used in a long time.

Alert on changes, not absolute numbers. A provider that normally sees a handful of reauthorizations a day suddenly showing hundreds usually means the provider changed something, or your app's verification lapsed.

Proactive checks#

Some connections are only used occasionally, so failures go unnoticed for weeks. A lightweight scheduled check, such as a token refresh or a cheap read-only API call, surfaces problems before the customer needs the integration. Keep these checks infrequent to respect provider rate limits.

Recovery#

When a user reconnects:

  1. Update the existing connection rather than creating a new one.
  2. Confirm the external account matches the previous one, or handle the change deliberately.
  3. Resume any paused work and backfill data that was missed while the connection was broken.

Measure time from failure to successful reconnect. It's a good indicator of how clear your notifications are.

Where Pathfix fits#

Pathfix OAuth handles token storage, refresh and authenticated API passthrough across 350+ providers, which removes much of the refresh logic you'd otherwise monitor yourself. Your application still decides how to present connection problems to users and what to do when an API request fails.

If you run integrations as workflows, Pathfix Automation includes execution tracking and history so you can see which runs failed and why. See the Automation documentation for details.

Frequently asked questions#

Should I alert on every 401?#

No. A 401 followed by a successful refresh is normal. Alert when refresh fails, or when authorization errors rise sharply for a provider.

How quickly should users be notified?#

As soon as a connection is confirmed to need reauthorization, with a short delay to avoid notifying on brief transient errors.

What if the user who connected has left the company?#

Let other admins in the customer's account reconnect the integration, and send notifications to account admins as well as the original user.