Skip to main content
This page is part of an AI coding agent skill and is written for agents, not humans. For the human-readable Base44 docs, see the developer documentation.

Connectors Module

OAuth token management for external services, giving you raw tokens to call external APIs directly (unlike integrations, which wraps pre-built calls).
  • base44.connectors — App user OAuth flows: start/disconnect the current user’s own connection (frontend).
  • base44.asServiceRole.connectors — Retrieve tokens and call metered connectors (backend/service role only).
There are two connector types, by whether the token is shared across the app or specific to each user:
  • Shared connectors: One OAuth token shared by all app users (e.g. posting to a company Slack channel). Two forms: platform connectors (connected from the app’s Integration settings, identified by an integration type string, retrieved with getConnection()) and workspace-registered connectors (your own OAuth app, registered in Workspace Settings, identified by a connector ID, retrieved with getWorkspaceConnection() — e.g. Databricks, Snowflake).
  • App user connectors: Each signed-in app user has their own token (e.g. sending from their own Gmail). Start the flow from the frontend with connectAppUser(), then retrieve the token in a backend function with getCurrentAppUserConnection().

Contents


App User Connectors (base44.connectors)

Frontend methods for the current app user’s own OAuth connection. Keyed by connector ID (a workspace-registered connector), not integration type.

Methods

After the user completes the OAuth flow, retrieve their token from a backend function with the service role’s getCurrentAppUserConnection() (below).

Service Role Connectors (base44.asServiceRole.connectors)

Backend/service role only.

Methods

getConnection(integrationType)

Shared OAuth token and config for a platform connector (one connected from the app’s Integration settings), identified by integration type. All app users share this token.

getWorkspaceConnection(connectorId)

Shared OAuth token and config for a workspace-registered connector (your own OAuth app, registered once in Workspace Settings and consented to by the app builder) — e.g. Databricks, Snowflake. Shared-token counterpart of getCurrentAppUserConnection(). Identified by connector ID (from the connector’s settings page in Workspace Settings), not integration type.

getCurrentAppUserConnection(connectorId)

Per-app-user OAuth token and config for an app user connector. Requires a client built with createClientFromRequest(req) so the runtime knows which app user’s connection to resolve. The connector must be registered in Workspace Settings, and the app user must have completed connectAppUser() first.

Metered Connectors

A few platform connectors are backed by paid third-party APIs that charge Base44 per call. For those, the OAuth token isn’t available to your code — getConnection() rejects with a permission error. Call them with callApi() instead; Base44 attaches the credential server-side, forwards the request, and charges your workspace’s credits. This applies to platform connectors only — workspace-registered and app user connectors run on your own OAuth app and keep normal token access.

callApi(integrationType, request)

Returns: Promise<ConnectorApiResponse>. Provider and transport outcomes come back in the response (success, phase, status), not thrown — only Base44-side failures (auth, quota, invalid proxy request) reject the promise. Only phase: 'not_sent' proves the provider never executed the request; 'timed_out'/'sent_unconfirmed' may have executed upstream, so don’t blindly retry non-idempotent calls on those.
Cost varies by endpoint, sometimes sharply for the same connector — avoid calling an expensive endpoint in a loop, and batch where the provider supports it. Each response reports its cost in creditsCharged.

Available Connectors

Use the integration type with getConnection()/callApi() for platform connectors, or the connector ID with getWorkspaceConnection()/getCurrentAppUserConnection() for workspace-registered/app user connectors. Run npx base44 connectors list-available from the CLI to see all available types.

Setup Requirements

  1. Builder plan or higher
  2. Backend functions enabled (for service role connectors)
  3. Connector configured in Base44 dashboard (OAuth flow completed), or registered in Workspace Settings for workspace-registered/app user connectors

Important Notes

  • Shared (service role) connectors: One account per connector per app — all users share the same connected account.
  • App user connectors: Each app user has their own token; start with base44.connectors.connectAppUser(), retrieve with the service role’s getCurrentAppUserConnection().
  • You handle the API calls: for non-metered connectors, Base44 provides the token; you make the actual API requests. For metered connectors, use callApi() instead — you never see the token.
  • Token refresh: Base44 handles token refresh automatically.

Type Definitions