LLMs Technical Reviews

How is third-party authentication implemented?

OAuth2 flows, API keys, token refresh, credential storage and encryption, multi-tenant connected accounts.

Verdict

If you must run OAuth for many end users on your own servers, ACI, Nango and Activepieces have the most complete credential systems in code. Composio and Pipedream solve the same problem well, but only inside their hosted vaults.

Self-hosted vaults that refresh at call time. ACI stores each end user as a LinkedAccount and encrypts only the secret fields with AWS KMS envelope encryption. One weak point: the PKCE verifier travels in a signed but readable state JWT with no expiry. Nango drives about 15 auth modes from providers.yaml, encrypts connections with AES-256-GCM, and takes a per-connection Redis lock for refresh. The editor found that credentials are stored as plaintext when NANGO_ENCRYPTION_KEY is unset. Activepieces uses AES-256-CBC, treats a token as expired 15 minutes early and refreshes under a distributed lock. Its key is generated automatically only in in-memory dev mode. Executor uses OAuth 2.1 with PKCE on oauth4webapi and pluggable credential providers such as 1Password, the OS keychain and WorkOS Vault. It resolves credentials only after a call is approved.

Gateway auth to upstreams. ContextForge supports client credentials, password, authorization code with PKCE and RFC 8693 token exchange. It stores tokens in its database (Fernet with an Argon2id-derived key) or in HashiCorp Vault.

Hosted vaults behind an SDK. Composio polls a connection request once a second until it is ACTIVE, and the client refresh() is deprecated. Pipedream runs OAuth in a Connect iframe that returns an authProvisionId. The editor found that the SDK’s only refresh code covers its own client-credentials token, not end-user tokens. Metorial integrations implement the authorize, callback and refresh handlers, but token storage and refresh timing belong to its platform, which is not in this repo.

Tokens passed in. Klavis servers read AUTH_DATA or an x-auth-data header. Its Strata router can run local OAuth, but it keeps tokens as plaintext JSON for a single user. merge-mcp takes one API key and one account token per process.

Pick: ACI or Nango for a multi-tenant vault you host yourself. Pick: Executor or ContextForge to keep secrets in an external vault behind policy. Pick: Composio or Pipedream if you are happy to let a vendor hold the tokens.

Per-project answers

ComposioHQ/composio

answered

Authentication in Composio supports 11 auth schemes defined in both SDKs. The AuthScheme class (Python: python/composio/core/models/connected_accounts.py:123-353, TS: ts/packages/core/src/models/AuthScheme.ts:8-206) provides factory methods for OAuth2, OAuth1, API_KEY, BASIC, BEARER_TOKEN, BASIC_WITH_JWT, GOOGLE_SERVICE_ACCOUNT, COMPOSIO_LINK, CALCOM_AUTH, BILLCOM_AUTH, and NO_AUTH. OAuth2/1 flows are redirect-based: ConnectedAccounts.initiate() (Python: python/composio/core/models/connected_accounts.py:589-732) begins the flow and returns a ConnectionRequest with a redirect_url, while wait_for_connection() polls until the connection is ACTIVE or enters a terminal state. The newer link() method (Python: python/composio/core/models/connected_accounts.py:734-839) creates a Composio Connect Link and is the recommended path for Composio-managed OAuth. For custom OAuth apps, complete_auth() (Python: python/composio/core/models/connected_accounts.py:462-490) redeems a session URI after the user's identity is verified. Connected accounts are multi-tenant: each is scoped to a user_id and auth_config_id. ACLs on SHARED connections allow per-user allow/deny lists via update_acl() (Python: python/composio/core/models/connected_accounts.py:522-587). Credential encryption uses JWEs via the organization's customer-managed keyring: Keyring.listTransferKeys() (TS: ts/packages/core/src/models/Keyring.ts:56-64) returns RSA-OAEP-256/A256GCM public keys for sealing secrets client-side before sending them to Composio. Token refresh on connected accounts is deprecated; the API now recommends re-initiating auth instead.

activepieces/activepieces

answered

Third-party authentication is implemented through a layered system of piece-level auth schemas and server-side OAuth2 handlers.

Piece auth definitions live in each piece's source — Slack's slackAuth field shows the pattern: PieceAuth.OAuth2({ authUrl, tokenUrl, scope, required }) for OAuth2, PieceAuth.SecretText() for API keys, and PieceAuth.CustomAuth({ props, validate }) for multi-field credentials (Slack: botToken + userToken). Each auth type can carry a validate callback that is invoked at connection time (packages/pieces/community/slack/src/lib/auth.ts:11-47, 82-118).

Server-side OAuth2 flow is orchestrated by appConnectionService. On upsert, validateConnectionValue dispatches by connection type (packages/server/api/src/app/app-connection/app-connection-service/app-connection-service.ts:691-788). For OAUTH2, the credentialsOauth2Service.claim() POSTs the auth code to the piece's tokenUrl using safeHttp.retryingAxios, supporting both authorization_code and client_credentials grants, BODY or HEADER authorization methods, and PKCE (packages/server/api/src/app/app-connection/app-connection-service/oauth2/services/credentials-oauth2-service.ts:16-106). After claiming, engineValidateAuth sends the credential to the engine sandbox for the piece to self-validate (packages/server/api/src/app/app-connection/app-connection-service/app-connection-service.ts:790-841).

Token refresh occurs automatically on each connection read (via decryptAndRefreshConnection): isExpired() checks if the token is within 15 minutes of expiry (packages/server/api/src/app/app-connection/app-connection-service/oauth2/oauth2-util.ts:31-48), then credentialsOauth2Service.refresh() POSTs the refresh_token to the token URL with timing-safe client credential resolution through the secrets manager (packages/server/api/src/app/app-connection/app-connection-service/oauth2/services/credentials-oauth2-service.ts:108-181). A distributed lock prevents concurrent refreshes.

Credential storage encrypts the entire value object via AES-256-CBC (encryptUtils.encryptObject) using the AP_ENCRYPTION_KEY env var or an auto-generated secret (packages/server/api/src/app/helper/encryption.ts:45-47, 72-81). Three OAuth2 "flavors" exist: OAUTH2 (user-provided client), CLOUD_OAUTH2 (cloud-managed), and PLATFORM_OAUTH2 (platform-admin-managed central credentials).

Multi-tenant isolation is enforced through projectIds array columns, platformId, and scope (PROJECT/PLATFORM) — every query filters by these (packages/server/api/src/app/app-connection/app-connection-service/app-connection-service.ts:158-163, 194-198).

NangoHQ/nango

answered

Nango supports 15 distinct auth_mode values, the most numerous being API_KEY (344 providers), OAUTH2 (304), OAUTH2_CC (106), BASIC (100), and TWO_STEP (68). The providers.yaml at the package root defines each provider's auth mode, credential schema, and token URLs — Zendesk Sell shows a typical OAUTH2 entry with authorization_url, token_url, refresh_params, and proxy config. OAuth2 flows follow the standard authorization-code grant; the server's OAuth controller in oauth.controller.ts handles the callback, stores tokens, and initiates refresh. API keys and Basic auth use dedicated handlers: postApiKey.ts validates an apiKey credential against the provider's schema while postBasic.ts handles username/password pairs. Credential storage encrypts artifacts via node:crypto HKDF + JWE AES-256-GCM in crypto.ts. The Data Encryption Key comes from the DekRegistry in env.ts. Token refresh runs through refreshOrTestCredentials invoked by the proxy service before every request, with a 60-second memoized TTL. Multi-tenant connected accounts are scoped by connection_id + providerConfigKey, resolved via connectionService.getConnection(). The Connect UI in connect-ui/ provides a white-label embedded auth flow launched through connectSession.service.ts with session tokens.

Editor's note. Correction: oauth-server/lib/crypto.ts (HKDF + JWE) encrypts the MCP OAuth server's own artifacts, not connections. Connection credentials are encrypted with AES-256-GCM by EncryptionManager.encryptConnection using NANGO_ENCRYPTION_KEY, and are stored in plaintext if no key is configured.

PipedreamHQ/pipedream

answered

OAuth2 flow. App components read tokens from a runtime-injected this.$auth object, e.g. this.$auth.oauth_access_token (GitHub). The cloud platform executes the OAuth2 authorization-code grant; the open-source repo does not contain the redirect endpoint or token-exchange handler. Slack (v2) additionally accesses oauth_uid, bot_token, and a tenant-specific base_url. The AppAuthType enum in the SDK defines three categories: OAuth, Keys, None. OAuth1 requests are signed via the platform axios helper which POSTs to an external oauthSignerUri for the signature.

Credential storage and encryption. The credential vault is proprietary (pipedream.com cloud). The push-registry-app-files-supabase GitHub Action uploads only the .app.mjs files to Supabase; tokens and secrets never appear in the repo.

Token refresh. The server-side SDK manages OAuth client-credentials grants: ensureValidOauthAccessToken() maintains a cached access token with expiry checking and retry logic against api.pipedream.com/v1/oauth/token.

Multi-tenant connected accounts (Pipedream Connect). The SDK exposes createConnectToken() to mint time-bound tokens for end-users. The browser SDK provides startConnect() for the OAuth UI flow. getAccountById() retrieves connected accounts optionally including credentials. Apps are looked up by name_slug from the registry; each app record carries its auth_type.

Editor's note. Correction: ensureValidOauthAccessToken() refreshes only the Connect SDK's own client-credentials token for api.pipedream.com; refreshing end users' third-party OAuth tokens happens in Pipedream's cloud and is not in this repository.

Klavis-AI/klavis

answered

Third-party auth uses two approaches. OAuth2 via Klavis cloud (_oauth_support/oauth_acquire.sh:1-93): Docker wrapper calls api.klavis.ai to create OAuth instance, shows URL, polls until authorized. Strata OAuth provider (open-strata/src/strata/mcp_proxy/auth_provider.py:160-200): OAuthClientProvider with authorization_code/refresh_token grants. LocalTokenStorage (auth_provider.py:27-54) persists tokens to .tokens/{name}/tokens.json. CallbackServer on port 3030 (auth_provider.py:110-154). HTTPTransport (transport/http.py:46-80) passes provider when auth=oauth. Multi-tenant: per-server OAuth instances. Servers like Airtable (mcp_servers/airtable/server.py:43-70) extract tokens from AUTH_DATA or x-auth-data header.

aipotheosis-labs/aci

answered

Third-party authentication uses three mechanisms. PropelAuth handles web portal auth (JWT tokens via HTTPBearer) — every user-facing route depends on auth.require_user (main.py:136, acl.py:15-19). API keys are for agent/programmatic access: validated by validate_api_key in dependencies.py (lines 48-69), which looks up the key via crud.projects.get_api_key, checks status (active/disabled/deleted), and returns a UUID key ID. API keys are stored encrypted at rest via the Key SQLAlchemy type decorator (custom_sql_types.py:29-48) which calls encryption.encrypt() using AWS KMS. A SHA-256 HMAC of the key is also stored for lookups. Linked accounts store end-user credentials per app per project (sql_models.py:398-455). The security_credentials JSONB column uses EncryptedSecurityCredentials (custom_sql_types.py:84-157) which encrypts individual fields (secret_key, access_token, refresh_token) via AWS KMS. The OAuth2Manager (oauth2_manager.py:16-162) handles the full OAuth2 code flow — create_authorization_url builds state-JWT-encoded redirect URLs, fetch_token exchanges codes with PKCE (S256), and refresh_token rotates expired tokens. Token expiry is checked in security_credentials_manager.py:213-216 and auto-refreshed at execution time (lines 98-132). App-level OAuth2 client credentials can be overridden per configuration via security_scheme_overrides (sql_models.py:351-354). The multi-tenant model links each API key → agent → project → org (sql_models.py:69-127).

IBM/mcp-context-forge

answered

Third-party authentication is implemented through multiple mechanisms, layered on top of internal JWT-based auth.

OAuth2 / SSO Providers: Seven SSO providers are supported via OAuth2/OIDC: GitHub, Google, Microsoft Entra ID, Okta, Keycloak, ADFS, and a generic OIDC provider (Auth0, Authentik, etc.). The SSO router exposes POST /auth/sso/{provider} to initiate the authorization-code flow. Each provider is configured through environment variables with client_id, client_secret, authorization_url, token_url, scope, and group/role mappings. Provider configs are also manageable at runtime via CRUD endpoints on SSOService.

OAuth 2.0 Token Management: The OAuthManager handles Client Credentials (M2M), Password, and Authorization Code grant types. It implements PKCE (RFC 7636) and supports refresh_token flow. The token-exchange grant (RFC 8693) is also implemented for gateway-based on-behalf-of flows. OAuth tokens for upstream MCP servers are stored encrypted — either in the database or in HashiCorp Vault (pluggable backend via oauth_token_backend config).

API Keys / JWT Tokens: The tokens router provides CRUD for scoped API tokens with named token creation, team scoping, and revocation via blocklist. Token teams are decoded via normalize_token_teams(). Token creation uses TokenCatalogService for scope derivation and PermissionService for RBAC containment checks.

Credential Encryption: The EncryptionService encrypts stored client secrets using an Argon2id-derived Fernet key with a v2: format marker, supporting both strict and idempotent modes.

Dynamic Client Registration: The DcrService implements RFC 7591 for automatic OAuth client registration, and RFC 8414 for AS metadata discovery.

Multi-tenant connected accounts: Team-based RBAC and token scoping control what each authenticated user can see and do. The SSOService supports auto-creating users from SSO, trusted-domain filtering, and team/role mapping from IdP groups.

Email Auth: The EmailAuthService and email auth router implement Argon2id-password-based login as an alternative, with lockout, password expiry, and reset workflows.

UsefulSoftwareCo/executor

answered

Executor implements OAuth 2.1 (authorization code + PKCE) and static credential (API key, header, bearer token) auth methods.

OAuth 2.1 flow lives in oauth-helpers.ts and delegates the RFC work to the oauth4webapi library (stateless, pure Web Crypto + fetch, no deps). A flow starts by creating a PKCE code verifier + S256 challenge, building an authorization URL with buildAuthorizationUrl() (line 219), and persisting an OAuth session (15-min TTL). The callback completes the code exchange inside oauth-client.ts's types. The OAuth client is self-contained (carries its own endpoints) and integration-independent, so the same app can back connections on any integration sharing that provider.

Token refresh uses skew-aware logic: OAUTH2_REFRESH_SKEW_MS = 60_000 (line 111) triggers a refresh before actual expiry. The shouldRefreshToken utility checks stored expiresAt minus skew. Refresh tokens are stored per-connection on the connection row (the expiresAt and oauthScope fields on the Connection interface in connection.ts, lines 41-59). Two concurrent refreshers racing on the same rotated token are handled via persisted refresh-token-based dedup.

Enterprise-Managed Authorization (EMA, id-jag draft) in oauth-ema.ts supports the MCP enterprise profile: an identity assertion from SSO is exchanged for an ID-JAG at the IdP, then redeemed at the Resource Authorization Server for an access token.

Credentials use the CredentialProvider interface in provider.ts (line 24): the default writable store holds pasted values, while external backends (1Password, keychain, WorkOS vault) resolve an opaque ID on demand — the value never lands in core storage. A connection binds to ONE auth method via template and resolves variable→value inputs. Placements are rendered onto HTTP requests by renderAuthPlacements() in http-auth/auth-method.ts (line 95), which maps credential variables to headers/query params with optional prefixes ("Bearer ").

Multi-tenant routing is handled by the OAuth callback state encoding: encodeOAuthCallbackState() in oauth.ts (line 59) wraps the raw random state with the org slug so the callback can route to the correct organization before completing the flow.

metorial/metorial

answered

Authentication is a typed method stack per integration via @slates/provider SDK. SlateAuth.create() holds multiple methods (integrations/slack/src/auth.ts:247-458). Four auth types in packages/proto/src/types/authMethod.ts: auth.oauth, auth.token, auth.service_account, auth.custom with typed schemas and capabilities.

OAuth2: platform calls slates/auth.authorization_url.get, invokes getAuthorizationUrl (packages/provider-handler/src/index.ts:709-757). After user auth, slates/auth.authorization_callback.handle invokes handleCallback (packages/provider-handler/src/index.ts:654-707). Slack exchanges code at /oauth.v2.access (integrations/slack/src/auth.ts:281-327).

Token refresh via slates/auth.token_refresh.handle (packages/provider-handler/src/index.ts:815-873; integrations/slack/src/auth.ts:302-323). Credential redaction via AuthConfigSecretRedactor (packages/provider/src/auth/redact.ts:15-60). API key uses getOutput, Slack Bot Token validates xoxb- prefix then auth.test (integrations/slack/src/auth.ts:397-426). Multiple OAuth (bot/user) and token methods coexist per integration.

merge-api/merge-mcp

answered

There is no OAuth2 flow, credential encryption, or token refresh mechanism in the repo. Authentication is a simple API-key-based bearer-token scheme implemented in MergeAPIClient.__init__ (client.py:60-66). The client reads MERGE_API_KEY and MERGE_ACCOUNT_TOKEN from environment variables (or constructor parameters) and stores them as instance fields. Every outgoing request to the Merge API includes an Authorization: Bearer {api_key} header and an X-Account-Token header, built in _get_headers (client.py:237-258). The optional MERGE_TENANT env var selects the regional base URL (US → api.merge.dev, EU → api-eu.merge.dev, APAC → api-ap.merge.dev) (client.py:77-84). A generated MCP-Session-ID (UUID4) is also sent on every request (client.py:254). The singleton pattern on the client prevents multiple instances. The Merge API handles the actual account linking and multi-tenant credential management server-side — this MCP server is just a thin proxy that passes the credentials through. The OpenAPI schema endpoint can be called "unauthorized" (no auth headers), but all other endpoints require authentication (client.py:250-253).

How is an integration / connector defined? →