How to Handle OAuth Across Many Integrations
·
To handle OAuth across many integrations, run it as one shared service rather than as code inside each integration: one encrypted token store, one callback endpoint, refresh ahead of expiry with one refresh per connection at a time, your own permission names mapped to each vendor's scopes, and a connection status your product checks before each call. The easiest way to get that service is a managed authorization layer that runs the consent flow, stores and refreshes tokens, and tells you when a connection breaks, so your application keeps one connection ID per customer connection. Unified.to does this inside its unified API across 2981 integrations: the connection that holds the tokens also serves reads, writes, webhooks and MCP tools in one data model per category. As of 26 November 2026, only 371 of its integrations accept OAuth 2 alone and so need an OAuth app registered by you before they go live.
Past a handful of APIs, OAuth stops being per-integration code and becomes infrastructure. Teams that keep it per integration run into broken tokens, inconsistent scopes, refresh race conditions and connections that fail without anyone noticing.
What is the easiest way to handle authorization for 100+ integrations?
Choose the layer by how much of each integration you want to own: a managed OAuth layer takes the authorization work and leaves you each vendor's API calls, while a unified API takes both, for the categories it covers.
| Approach | Examples | Handles authorization | You still write |
|---|---|---|---|
| Build in-house | Your own service | You do | Every flow, the token store, refresh locks, scope mapping and reconnect paths |
| Managed OAuth and proxy | Nango, Pipedream Connect | Consent flow, token storage and refresh | Each vendor's API calls and data mapping |
| Agent tool runtime | Composio, Arcade | Per-user consent and token injection for tool calls | Cross-vendor logic, because tools return each vendor's own schema |
| Embedded iPaaS | Paragon | Consent UI and credential storage | Automations in the vendor's builder |
| Unified API with managed authorization | Unified.to | Consent flow, token storage and refresh, connection health | Product logic against one data model per category; vendor-specific calls through the Passthrough API |
| Whichever layer you choose, work through the list in this order: |
- Sort the integrations by authorization type. As of 26 November 2026, 565 of the 2,556 integrations on Unified.to's integration pages offer OAuth 2, 194 of those also accept another credential such as an API key, and the rest use API keys, tokens or other credentials your customer enters.
- Register your own OAuth app for each OAuth-only integration you launch, starting with the ones customers ask for first. Before that, Unified.to's own OAuth app covers testing outside Production on many OAuth 2 integrations. Google reviews apps that request sensitive or restricted scopes, so start those reviews early.
- Embed one authorization component for every integration and store the connection ID it returns, never the tokens themselves.
- Build one reconnect path. Subscribe to the connection-health notifications webhook and show the same reconnect prompt whichever vendor broke.
- Request only the scopes each feature needs. Unified scopes such as
crm_contact_readmap to each vendor's own scope strings.
For whether to launch on a vendor's OAuth app or your own, see managed OAuth apps vs your own OAuth apps.
What handles token refresh and OAuth scopes for third-party integrations?
Token refresh and OAuth scopes for third-party integrations are handled by whichever layer holds the tokens: your own backend, a token vault in an identity platform, an agent tool runtime, or a unified API that runs authorization for each connection. The vendor's authorization server issues the tokens and enforces the scopes; your chosen layer requests the scopes at consent, stores the tokens and refreshes them.
| Layer | Examples | Token refresh | Scopes | What your code works with |
|---|---|---|---|---|
| Your own backend | Your OAuth service | You run it, with one refresh per connection at a time | You request each vendor's scope strings | Tokens, used against each vendor's API |
| Identity-platform token vault | Auth0 Token Vault, Descope Outbound Apps, WorkOS Pipes | Handled by the vault; your backend fetches a current access token | Requested at consent | A vendor access token, used against each vendor's API |
| Agent tool runtime | Composio, Arcade | Tokens held by the runtime for each user | Granted by each user for the tools you enable | Tool calls in each vendor's schema |
| Unified API with managed authorization | Unified.to | Automatic per connection, including vendors that rotate refresh tokens | Unified scopes such as crm_contact_read, mapped to each vendor's strings, plus vendor-native scopes | One connection ID for reads, writes, webhooks and MCP tools in one data model per category |
| The three identity-platform vaults, as their own docs describe them on 26 November 2026: |
- Auth0 Token Vault stores "the access and refresh tokens for each connected account"; your app exchanges an Auth0 refresh token for the external provider's access token. With Auth0 Organizations, "Each organization member connects and authorizes their own external account" (Auth0 docs).
- Descope Outbound Apps handle "the full OAuth lifecycle" (consent, token refresh and scope management) as a token vault "at the user or tenant level", and you can start with minimal scopes and request more later (Descope docs).
- WorkOS Pipes: "WorkOS runs the OAuth flows, stores the credentials, and refreshes tokens"; your backend fetches an access token per provider, user and organization, and an organization administrator can connect a provider once and share it with every member (WorkOS docs).
The difference that matters for a B2B product is what comes after the token. A vault hands your backend a current access token, and your code then calls each vendor's API in that vendor's format. On Unified.to, the connection that holds the token is also the thing you call: the same request reads contacts from Salesforce or HubSpot in one shape, and your code never has to handle the token itself.
Why does OAuth become a bottleneck across many integrations?
OAuth becomes a bottleneck because OAuth 2.0 is a framework each vendor implements in its own way, so every new integration brings its own flows, scopes, token rules and errors.
When integrating with platforms like Google, Slack, Salesforce, HubSpot, and Microsoft, you encounter:
- different OAuth flows (authorization_code, client_credentials, API keys)
- inconsistent scope naming (contacts.read vs read_contacts)
- different token formats and expiration rules
- refresh token rotation vs static refresh tokens
- redirect URI inconsistencies
- HTML vs JSON error responses
- varying rate limits and retry requirements
- tenant-specific authorization URLs, such as Shopify's per-shop domain, and token responses that carry the URL to call next, such as Salesforce's
instance_url - extra fields in token responses that later calls need, such as Slack's team ID
Each new integration adds edge cases, so past a handful of vendors OAuth turns from per-integration code into a reliability problem.
How do you manage OAuth across many SaaS integrations?
Manage OAuth across many SaaS integrations as one shared service: a single token store, one callback endpoint, refresh that runs ahead of expiry with one refresh per connection at a time, scopes mapped to your own permission names, and a connection status your product checks before it calls a vendor. The parts below are what that service needs, whether you build it or use a managed layer such as Unified.to.
1. Centralized token store
All tokens should be stored in a single, secure system.
Each record should include:
- user_id or tenant_id
- provider
- access_token
- refresh_token
- expires_at
- scopes
Best practices:
- encrypt tokens at rest (AES-256)
- use envelope encryption with systems like AWS KMS or HashiCorp Vault
- always scope queries per tenant (never global access)
This becomes your single source of truth for all integrations.
2. Shared OAuth service layer
Instead of handling OAuth separately for every API, build a shared service that handles:
- authorization URL generation
- callback handling
- token exchange
- token refresh
- revocation handling
Typical interface:
- getAuthorizationUrl(provider, user)
- exchangeCode(provider, code)
- refreshToken(connectionId)
- getValidToken(connectionId)
This removes duplicated logic across integrations.
3. Standardized redirect handling
Use a single callback endpoint:
/auth/callback
Use the state parameter to encode:
- provider
- tenant_id
- nonce
This allows one endpoint to handle all integrations safely.
4. Proactive token refresh
Don't rely on a 401 to trigger a refresh; some APIs signal an expired or revoked token with a 403 or a 400 and their own error body.
Instead:
- refresh tokens before expiration (e.g. 5–10 minutes early)
- run background workers to manage refresh cycles
- track expiration centrally
This prevents production failures and improves reliability.
5. Concurrency-safe token refresh
One of the most common failure points is race conditions.
Without protection:
- multiple requests trigger refresh simultaneously
- refresh tokens get overwritten
- tokens become invalid
Solution: locking
Single instance:
- in-memory locks
Distributed systems:
- Redis-based locking (e.g. Redlock)
Example pattern:
- only one refresh runs per connection
- all other requests wait for completion
This avoids token corruption.
6. Scope normalization
Every provider defines scopes differently.
Examples:
- contacts.read
- read_contacts
- crm.objects.contacts.read
To manage this:
- define internal 'unified scopes'
- map provider scopes to internal ones
This simplifies permission management across integrations.
7. API request guardrails
Every API request should:
- validate token freshness
- retry on 401 with refresh
- respect provider rate limits
- handle provider-specific errors
This logic should live in your OAuth layer, not in product code.
8. Security baseline
Follow RFC 9700, the OAuth 2.0 Security Best Current Practice published in January 2025:
- use the authorization code flow with PKCE (S256), and avoid the implicit grant
- make the
stateparameter cryptographically random and single-use, and match redirect URIs exactly - rotate refresh tokens, or bind them to the client, where the vendor supports it
- keep client secrets in a secrets manager, with separate OAuth apps for development, staging and production
- log the connection ID, vendor, outcome and timing, never tokens or authorization codes
On Unified.to, API call logs hold operational metadata only (endpoint, timing, status, workspace), never payloads, and connection credentials are encrypted at rest, or kept in your own secrets manager on Pro and Scale.
What goes wrong after OAuth is set up?
After setup, OAuth failures come from tokens changing state outside your control.
Common issues include:
Token drift
Tokens expire at different times across integrations.
Revocations
Users disconnect apps externally, breaking integrations silently.
Refresh failures
An invalid_grant error means the refresh token itself is no longer valid: mark the connection as needing reconnection, stop retrying, and show the customer a reconnect prompt.
Rate limits
Some providers throttle token refresh aggressively.
Observability gaps
Teams don't know when connections are broken.
Without centralized handling, these issues multiply quickly.
Should you build OAuth infrastructure or buy it?
Build OAuth infrastructure yourself for a few integrations; past that, the operating work grows with every vendor, and that work is what managed layers take on.
At scale, many adopt tools like:
These tools help with:
- OAuth flows
- token storage
- refresh logic
- provider configuration
However, they still introduce tradeoffs:
- additional infrastructure layer
- data handling considerations: a vendor holds your customers' credentials (Paragon stores them in its own vault)
- on Nango, token export only if you used your own OAuth app
- need to coordinate with your API layer
For a vendor-by-vendor comparison, see best managed OAuth providers for SaaS integrations.
How does Unified.to handle OAuth across 2981 integrations?
Unified.to handles authorization in the same layer as the integrations: your application stores one connection ID per customer connection and makes the same calls whichever vendor sits behind it. Measured against the questions teams use to compare managed OAuth providers, here is what Unified.to does (as of 26 November 2026). For the mechanics, see how we normalize OAuth across integrations.
| Question | How Unified.to handles it |
|---|---|
| Token lifecycle | Stores tokens encrypted, tracks expiry, and refreshes access tokens, and refresh tokens where the vendor rotates them, automatically |
| Connection status | Tests each new connection against the permissions you requested and returns 403 rather than creating a broken one; each connection reports when it was last healthy or unhealthy, and a notifications webhook tells your backend when a connection's health or authorization changes |
| Whose app is on the consent screen | Yours: in production you register your own OAuth app with each vendor, so customers authorize your application; before that, you can test with a real account through Unified.to's own OAuth app on many OAuth 2 integrations |
| Leaving | Tokens issued to your own OAuth app keep refreshing if you change providers, and you can export your credentials |
| Credential storage | Encrypted at rest, or in your own secrets manager on Pro and Scale, such as AWS Secrets Manager, Azure Key Vault, Google Cloud Secrets Manager, HashiCorp Vault, 1Password, Doppler or Bitwarden |
| Auth types beyond OAuth 2.0 | authorization_code, client_credentials, password and refresh_token grants, plus API keys and tokens where the vendor uses them |
| Authorization UI | Embedded components for React, Angular, Vue, Svelte and JavaScript; fork the public source code, or list activated integrations through the API and build your own; multilingual, with step-by-step instructions for vendors where end users enter their own credentials |
| Scopes | Unified scopes such as crm_contact_read map to each vendor's scope strings, and you can add vendor-native scopes |
| Redirects | One redirect URI per region: https://api.unified.to/oauth/code, plus EU and AU versions |
| Errors | The same 401, 403 and 400 responses across vendors |
| Regions | Each workspace runs in one region: US, EU or AU on every plan |
| Each connection is scoped to one customer account and the permissions you requested, and the same connection ID works for API calls, webhooks and Unified MCP. |
Why does centralizing OAuth matter for SaaS products?
Centralizing OAuth matters because authorization failures show up as product failures. OAuth affects:
- time to launch integrations
- reliability in production
- customer onboarding experience
- support burden
- security and compliance
When OAuth is fragmented:
- integrations break silently
- engineers spend time debugging auth issues
- customers must reconnect frequently
When OAuth is centralized:
- integrations behave consistently
- failures are predictable and visible
- onboarding becomes faster
Key takeaways
If you're building SaaS integrations:
- treat OAuth as infrastructure, not feature code
- centralize token storage and lifecycle management
- map scopes to your own permission names, and use one redirect flow
- implement concurrency-safe refresh logic
- build observability into connection health
Most of the work comes after the handshake: keeping OAuth reliable across dozens or hundreds of integrations.
FAQ
Why can't I use Unified.to**'s OAuth credentials in production?**
Unified.to's OAuth apps are registered to Unified API Inc., so in production your end users would be authorizing Unified.to, not your product, and vendor policies such as Google's require an app's brand information to "accurately represent the identity of the application." Use them to test outside Production, then register your own app, which keeps the consent screen, rate limits and tokens yours. See why you can't use Unified's OAuth2 credentials on Production, and for the trade-offs either way, managed OAuth apps vs your own OAuth apps.
How does Unified.to access a customer's data in a third-party app?
Through the vendor's own API, with access your customer grants. The customer authorizes the connection in your product, through the vendor's OAuth consent screen or with an API key or token they create in their own account, and Unified.to then calls the vendor's API with that credential on each request. It doesn't scrape the vendor's user interface. Access ends when the customer disconnects in your product or revokes the app at the vendor.
What is a managed OAuth provider?
A managed OAuth provider runs authorization for your third-party API integrations: the consent flow, token storage, refresh and revocation handling. Unified.to does this as part of its unified API, so the same connection that holds the tokens also serves normalized reads and writes, webhooks and MCP tools.
How do you refresh OAuth tokens automatically?
Refresh each token shortly before it expires, allow only one refresh per connection at a time, and retry a request once after a 401. On Unified.to, refresh runs per connection until the vendor invalidates the refresh token itself, through revocation, an admin policy or inactivity; the connection is then flagged for reauthorization. See how to check if an OAuth token is expired.
Can customers see your brand on the OAuth consent screen?
Yes, when you register your own OAuth app with each vendor: the consent screen then names your application. Unified.to's embedded authorization components can be restyled, forked from their public source, or replaced with your own UI built from the API.
What happens when a customer revokes access?
The next refresh fails, the connection is marked unhealthy, and your notifications webhook receives an event, so you can ask the customer to reconnect instead of discovering the failure later.
How should AI agents authenticate to a customer's SaaS account?
With a token that reaches only that customer's connection. Unified MCP issues a connection-scoped token, sent in the Authorization header, so the workspace API key stays on your server and the agent can't reach other customers' data.
Start building faster
→ Start your 30-day free trial
Written by Mallory Greene.
About the author: Mallory Greene is Head of Marketing at Unified.to_. She writes about integration infrastructure, unified APIs, and MCP for technical teams. Based in Toronto._