Most teams know they should be limiting credential scope in their embedded integrations. Far fewer have a clear picture of which tool handles which part of that problem. Scoped API keys, tenant JWTs, and expiring magic links aren't interchangeable, and knowing when to reach for each one is what separates a credential model that holds up under pressure from one that just looks fine until it doesn't.
TL;DR: In a multi-tenant embedded integration, scoped API keys, tenant JWTs, and expiring magic links each solve a different slice of the least-privilege problem — and hotglue handles all three out of the box across 38,000+ active tenants, without ever storing customer data between syncs.
| Credential Type | What It Controls | Typical Lifespan | Primary Security Benefit | Key Consideration |
|---|---|---|---|---|
| Scoped API Key | Access to specific objects/operations at the third-party system (e.g., read invoices only in QuickBooks Online) | Long-lived (until rotated or revoked) | Limits blast radius: a leaked key can only reach what it was scoped to | Must be stored server-side; never commit to repos or config files |
| Tenant JWT | Identity assertion within your own integration layer; binds calls to one tenant's context | Short-lived (typically 15 min access token; days/weeks for refresh token) | Structural tenant isolation: a token issued for Tenant A is incapable of reaching Tenant B's data | Pair short-lived access tokens with refresh token rotation (RFC 9700) |
| Expiring Magic Link | One-time authentication URL for tenant onboarding flows | Very short-lived (15-30 min window) | No persistent credential on the tenant's end; stolen links expire quickly | Must be single-use: invalidate on first click and on expiry to prevent replay |
What Least-Privilege Access Means in an Embedded Integration Context
Least-privilege access is a simple idea: any credential you issue should only open the doors it needs to open, nothing more. In embedded integrations, that principle has to hold across hundreds of tenants sharing one codebase.
When a B2B SaaS product embeds an integration layer, each tenant connects their own third-party accounts. One tenant links their QuickBooks Online, another connects Salesforce, a third authenticates Shopify. The host application ends up holding credentials on behalf of dozens or hundreds of different businesses, all running inside the same infrastructure.
That creates a specific obligation, one that typically lands on whoever owns the integration product: your CPO, Head of Partnerships, or the engineering lead responsible for your embedded integration layer. The access granted to any one tenant's integration must be:
- Scoped to only the data objects that integration actually reads or writes, not the full account.
- Isolated completely from every other tenant's credentials and sessions, so a breach in one doesn't ripple outward.
- Time-bounded where the use case allows it, so stale credentials don't quietly accumulate risk.
A tenant linking QuickBooks to sync invoices has no reason for their token to carry write access to payroll data. A customer-facing CRM integration pulling contacts shouldn't stay valid indefinitely if the user stopped using it six months ago. These aren't hypothetical concerns; they're the exact gaps that turn a credential leak into a cross-tenant incident.
Why Tenant Isolation Is the Core Security Problem
In a single-tenant integration, a misconfigured credential is your problem alone. In a multi-tenant architecture, it can be everyone's problem. (Congratulations, you're now everyone's problem.)
When hundreds of tenants share the same integration infrastructure, the credential layer becomes the only real boundary between them. One token scoped too broadly, one session that bleeds context across tenant IDs, and you have a path from one customer's data straight into another's. Broken access control (including cross-tenant access) is consistently ranked the single most serious web application security risk in the OWASP Top 10.

This is an architecture problem, not a configuration problem. Application logic that filters by tenant_id at query time is not the same as tokens that are structurally incapable of accessing another tenant's data. The distinction matters because application-layer filters fail. Tokens scoped and isolated at the credential level do not.
Scoped API Keys: Granting Only What a Tenant Needs
A scoped API key is a credential built with a ceiling. Where a full-permission key says "yes" to everything, a scoped key only opens the specific resources the integration actually needs.
In practice, that means defining access at the operation and object level before issuing the key. A tenant connecting QuickBooks Online to sync invoices and customers doesn't need a key that can modify payroll settings or delete accounts. You generate a key scoped to read invoices, read customers, period. If that key leaks, the blast radius is contained.
The alternative, broad hardcoded credentials, is how most incidents start. GitHub's own security report counted 39 million secret leaks in 2024 alone. Most weren't sophisticated attacks. They were wide-open keys committed to repos, baked into config files, or passed around in Slack threads. Scope minimization won't stop a credential from leaking, but it limits what an attacker can actually do with it.
How OAuth 2.0 and PKCE Enforce Least-Privilege at the Protocol Level
OAuth 2.0 defines what tokens are allowed to do, and also how they are issued. Every authorization request includes an explicit scope declaration, so permission boundaries are negotiated at the protocol level before any access happens.
RFC 9700, published in early 2025 as OAuth 2.0 Best Current Practice and the standing BCP since then, formalizes what practitioners had been applying informally for years: keep access tokens short-lived, rotate refresh tokens, and request only the minimum scopes a client actually needs. These are documented best practices from the IETF, not suggestions.
PKCE (Proof Key for Code Exchange) prevents authorization code interception by requiring the client to prove it initiated the original request, binding the code exchange to a specific session. Salesforce now requires PKCE for all external client apps, so teams building embedded Salesforce integrations are implementing it or they are blocked.
Tenant JWTs: Scoping Sessions to a Single Tenant's Context
A JWT is a signed token that carries claims. For embedded integrations, the most important claim is tenant identity.
When your integration layer issues a JWT with a tenant_id claim baked in, every downstream call that token makes is structurally bounded to that tenant's context. A token issued for Tenant A cannot access Tenant B's data. The boundary lives inside the token, not in application logic that might fail. This is the same boundary problem that shows up in AI agents and MCP auth.
There is a distinction worth drawing here: OAuth handles delegated authorization with a third-party system (getting Salesforce to grant your app access on behalf of a user). A tenant JWT handles something different, asserting who the caller is within your own integration layer. As the NHI Management Group summarizes it: OAuth is for delegated access; JWT is for stateless identity assertion between trusted components. They answer different questions and often work together.
Short expiry windows are the other half of this pattern. A tenant JWT valid for 15 minutes limits the window an attacker has if a token is intercepted. Pair short-lived access tokens with refresh token rotation, as RFC 9700 requires for public clients, and compromised tokens expire quickly while rotated refresh tokens cannot be replayed.
Expiring Magic Links: Reducing the Authentication Attack Window
Magic links are one-time URLs with a clock attached. A signed token gets embedded in the URL, the user clicks it, the token is validated and immediately consumed, and then the link stops working.
The security property that matters here is time. A stolen password can be used indefinitely. A stolen magic link is only dangerous inside its expiry window, typically 15 to 30 minutes. After that, it's inert.
For embedded integration onboarding, this is a practical win. You can issue a magic link that takes a tenant through connection setup without requiring any persistent credential on their end. When a link expires before the user finishes, you simply issue a new one. No credential rotation, no revocation ceremony.
The design decisions that actually matter:
- Single-use enforcement: the token must be invalidated on first use and on expiry, so intercepted links can't be replayed after the fact.
- Expiry duration calibrated to balance interception risk against user experience, short enough to matter, long enough that users can actually finish onboarding.
- State preservation on expiry, so a re-issued link drops the user back where they left off instead of restarting the flow from scratch.
Refresh Token Security: Storing Long-Lived Credentials Safely
Refresh tokens are the longest-lived credential in an OAuth exchange, which makes them the one worth stealing. Access tokens expire in minutes; refresh tokens can last days or weeks. That asymmetry is intentional, but it places the security burden squarely on how they are stored.
The rule is straightforward: server-side only. Never localStorage, never client-side code, never embedded in a frontend app. In a multi-tenant integration layer holding credentials for hundreds of tenants simultaneously, a client-side leak exposes whatever that token can reach across your entire infrastructure.
RFC 9700 requires refresh token rotation for public clients: each use replaces the old token with a new one, and any replay of a stolen token is detectable, triggering revocation of the entire token family.
Credential Isolation: Preventing Cross-Tenant Data Bleed
Logical isolation and true isolation are not the same thing. Filtering results by tenant_id in application code is a runtime decision that can fail silently. Separate credential stores, separate job contexts, and separately scoped tokens per tenant are structural decisions that fail loudly, or better, don't fail at all.
The difference shows up most clearly when a sync goes wrong. If Tenant A's job partially completes and writes state into a shared context, and Tenant B's job reads from that same context, you get cross-tenant data bleed with no error logged anywhere. Not a dramatic breach, but a quiet contamination that surfaces in a customer's data months later.
Silent partial success is worse than an explicit failure. A job that syncs 60% of records and reports success leaves your tenant's data in an unknown state with no signal to act on. Hotglue handles this directly: a partial sync failure either delivers all data or fails the job entirely, preserving state for retry with no silent half-writes.
Job-level state preservation is what makes retry safe. When a job fails, the integration layer needs to know exactly where it stopped, what was committed, and what was not, scoped entirely to that tenant's execution context. Mixing job state across tenants to save infrastructure overhead is a tradeoff that looks fine until it isn't.
Token Revocation and Access Lifecycle Management
Granting the right access at setup is half the problem. Taking it back cleanly is the other half.
Token expiry is passive: you set a lifespan and the credential eventually stops working. Revocation is active: you invalidate a token immediately, regardless of when it would have expired. When a tenant offboards, resets their third-party account, or you detect a security incident, expiry windows do not move fast enough. You need to revoke.
At the OAuth level, revocation means hitting the authorization server's token endpoint to invalidate both the access token and its paired refresh token. Invalidating only the access token leaves the refresh token alive, and a live refresh token means an attacker can issue fresh access tokens for as long as it sits unrevoked.
The discipline required here scales directly with tenant count. With ten tenants, manual revocation is annoying but manageable. With hundreds, you need a system:
- Structured per-tenant credential stores that make it possible to locate and target a specific tenant's tokens without touching anyone else's.
- Revocation APIs callable programmatically at offboard time, so access removal happens in the same workflow as account termination.
- Audit logs showing exactly when access was removed, which matters for compliance reviews and incident post-mortems alike.
Without that infrastructure, stale credentials quietly accumulate across your tenant base, which is a cost worth weighing in any in-house vs. embedded iPaaS decision.
SOC 2 and GDPR Alignment for Embedded Integration Security
SOC 2 Type II and GDPR are the two compliance frameworks that come up most reliably when an enterprise buyer's legal team gets involved. Knowing what they actually require saves time during security reviews.
For embedded integrations in particular, SOC 2 Type II's CC6 logical access controls require that access to systems holding tenant credentials is restricted to authorized personnel, that access rights are reviewed and revoked promptly when no longer needed, and that encryption protects credentials both in transit and at rest. CC7 requires continuous monitoring for anomalies, meaning a compliant vendor must log and alert on abnormal credential usage, and go beyond simply storing tokens securely. GDPR's Article 25 (data protection by design and by default) requires that personal data processed through integration flows is limited to what is strictly necessary for the stated purpose, which directly mirrors least-privilege: a tenant's sync job should request only the scopes it needs and retain no personal data after the sync completes.
SOC 2 Type II assesses whether access controls, data handling, and incident response work correctly over an extended period, producing a continuous record instead of a point-in-time snapshot. Ask any vendor: what is the audit period, who was the auditor, and can you share the report under NDA?
GDPR's data minimization principle maps directly onto least-privilege: personal data collected only for specified purposes, retained no longer than necessary. For embedded integrations, a vendor should process tenant data and deliver it to you, not warehouse it indefinitely. Hotglue is SOC 2 Type II and GDPR compliant by design and never stores customer data.
Questions worth asking any vendor before handing them tenant credentials:
- Are your connectors open-source, or black boxes with no visibility into how data is handled?
- What is your data retention policy after a sync completes?
- How are tenant credentials stored, and are they isolated per tenant at the infrastructure level?
- What is your incident response process if a credential is compromised across multiple tenants?
The answers will separate vendors who can survive a real security review from those whose compliance posture exists mostly in slide decks, and that distinction is a core part of choosing the right embedded iPaaS solution.
How hotglue Implements Least-Privilege Across 38,000+ Active Tenants
All of the patterns covered above are live across hotglue's infrastructure today. The system processes roughly 10 billion records weekly across 38,000+ active tenants on AWS ECS via Fargate, never storing customer data between syncs.
A few specifics worth noting:
- hotglue handles OAuth flows with third-party systems (QuickBooks Online, Salesforce via PKCE, Xero, Shopify, Airwallex, NetSuite, and more) on behalf of each tenant, so your engineering team never touches raw third-party credentials directly.
- Magic Links let tenants authenticate and connect without requiring your team to embed the widget, shrinking the credential surface area further.
- Partial sync failures never silently succeed. hotglue delivers all data or fails the job entirely, preserving state for retry.
- Connectors are open-source, so credential handling logic is inspectable code, not a vendor's promise.
The per-active-tenant pricing model reinforces this. When isolation is the unit of billing, it has to be structurally sound.
Final thoughts on Scoped Credentials and Tenant Isolation in Embedded Integrations
Building embedded integrations for multiple tenants means the credential layer carries real weight. Scoped API keys, tenant JWTs, and short expiry windows aren't overhead; they're what keeps a single bad token from touching data it was never supposed to reach. Getting these patterns right early is a lot less painful than retrofitting them after your first cross-tenant incident. hotglue handles all of this out of the box — OAuth, Magic Links, per-tenant credential isolation, open-source connectors, SOC 2 Type II compliance, and zero data storage between syncs — across 38,000+ active tenants today. If you're ready to stop managing credential complexity and start shipping integrations, book a demo and see it firsthand.
FAQ
How do scoped API keys and tenant JWTs work together in an embedded integration security model?
They solve two different problems. Scoped API keys limit what a credential can access at the third-party system level: a key issued for QuickBooks Online invoice sync carries no write access to payroll data. Tenant JWTs handle identity assertion within your own integration layer, binding every downstream call to a specific tenant's context so a token issued for one customer is structurally incapable of reaching another's data. Used together, they give you least-privilege access at both layers simultaneously.
What is the difference between OAuth 2.0 delegated authorization and tenant JWT identity in a multi-tenant SaaS integration?
OAuth 2.0 handles delegated authorization with a third-party system (getting Salesforce or Xero to grant your app access on behalf of a user). A tenant JWT handles something separate: asserting who the caller is within your own integration layer. OAuth answers "does this app have permission to act on this user's account?" while a tenant JWT answers "which of my tenants is making this request?" Both are needed in a production multi-tenant architecture, and they typically run in parallel instead of replacing each other.
Can I let customers connect QuickBooks Online or Salesforce without my engineering team handling raw OAuth credentials directly?
Yes. An embedded integration layer like Hotglue manages the full OAuth exchange with third-party systems on your behalf, so your team never touches raw access tokens or refresh tokens for tenant accounts. Hotglue handles Salesforce via PKCE (now required for all external client apps), QuickBooks Online, Xero, Shopify, and 650+ other connectors, storing nothing between syncs, with connectors that are open-source so credential handling logic is inspectable code and not merely a vendor promise.
How do expiring magic links reduce the embedded integration security attack window during tenant onboarding?
A magic link is a single-use, time-bounded URL (typically valid for 15 to 30 minutes) that gets invalidated on first click and on expiry. A stolen password works indefinitely; a stolen magic link stops working the moment the window closes or the link is consumed. For integration onboarding, Hotglue's Magic Link feature lets a tenant authenticate and connect their account without requiring your engineering team to embed the widget at all, which shrinks the credential surface area during what is often the riskiest moment in the tenant lifecycle.
What should I ask an embedded iPaaS vendor to verify their tenant credential isolation before handing them access to hundreds of customer accounts?
Four questions cut through most compliance slide decks quickly: Are your connectors open-source, or black boxes? What is your data retention policy after a sync completes? Are tenant credentials stored in separate per-tenant stores at the infrastructure level, or filtered by tenant_id in application code? And what happens, in concrete terms, if a credential is compromised across multiple tenants? The answers separate vendors with real structural isolation from those whose security posture lives in a PDF. For reference, Hotglue is SOC 2 Type II and GDPR compliant by design and processes data without storing it between syncs.