Base44 connectors: App connectors (TanStack Start)
<app_connectors> App connectors integrate the app with external services via OAuth. <connector_types>- Shared: builder connects their own account; all app users share it; server code acts on the builder’s behalf. See <connector_workflow_rules>.
- App user: builder provides OAuth app credentials (client ID, client secret); each app user connects their own account; server code uses that user’s tokens. See <app_user_connectors>.
- BYO shared: workspace admin registers their own OAuth app (a workspace connector); builder consents once; token shared across all app users. For services with no platform OAuth app (e.g., Snowflake, Databricks) or when the workspace wants its own. See <byo_shared_connectors>. </connector_types>
base44 connectors list-available lists the catalog, and the Base44 MCP list_connectors tool is the one source of each connector’s details for this app (description, scopes, auth status, connector_mode); connect or re-scope a shared connector with initiate_connector_connection / base44 connectors initiate passing the complete scope set (it replaces, never merges), and let the user finish OAuth in their browser. App-user and BYO-shared connectors are registered by a workspace admin in Workspace settings → Connectors. Before writing any connector code, read the connector’s connector_mode from list_connectors: app_user_only is app-user mode, shared_only is shared (connect it with initiate_connector_connection), and byo_shared_only is shared through a workspace-registered connector (see <byo_shared_connectors>; initiate_connector_connection covers platform-shared connectors only) — nothing to ask in those cases. When it allows both (all or byo_shared_and_app_user), ask the user which connection mode they want — shared (one account you connect serves every app user) or app user (each app user connects their own) — on every new request, even when a connector of that type is already registered or authorized.
</connector_decision_flow>
<supported_connectors>
The catalog is live: list it with list_connectors (MCP) or base44 connectors list-available; each entry gives the display name and its integration_type.
</supported_connectors>
Use the connector’s integration_type for getConnection.
Many connectors support webhooks: once authorized, create a workflow with a connector trigger whose step calls invoke_server_route on a POST server route (see the base44-platform-workflows skill).
<connector_workflow_rules>
App connectors require a Builder+ subscription; the app profile reports the workspace’s entitlement.
When the user asks to connect or use an external service:
- If the catalog has no connector for the service, do not use the connector APIs. Integrate with server code with secrets or direct API calls instead.
- Read the connector’s details (description, scopes, auth status, connection mode) with the Base44 MCP
list_connectorstool (base44 connectors list-availablelists the catalog only), and follow its connection mode: shared (one account serves every app user) or app user (each user connects their own). - Write connector-backed code only once the connector is authorized, and read its token in server code by connection mode: shared →
context.getBase44().asServiceRole.connectors.getConnection(integration_type); BYO shared →context.getBase44().asServiceRole.connectors.getWorkspaceConnection(connectorId)(see <byo_shared_connectors>); app user →context.getBase44().asServiceRole.connectors.getCurrentAppUserConnection(connectorId)for the signed-in app user, after the frontend let them consent withconnectAppUser(connectorId)(see <app_user_connectors>). Never serve one app user’s data through the shared account’s token. Then make the API calls yourself. </connector_workflow_rules> </app_connectors>
connectorId rather than integration_type.
Prerequisite — the workspace connector must already exist. A workspace admin registers it in workspace settings → Connectors with the OAuth client_id, client_secret and any integration-specific config such as a Snowflake subdomain; its id is the connectorId below. If none exists for the integration the user needs, tell the user to have their admin register one, then retry.
Consent is given once from the Base44 chat assistant in the app’s builder: tell the user to open the app in Base44 and ask the assistant to connect the workspace connector; the MCP initiate_connector_connection tool connects platform-shared connectors by integration type only.
No frontend code is generated for this mode — consent is a one-time build-time action, not a runtime action in the published app. Unlike APP_USER, there is no connectAppUser call.
Server function — use getWorkspaceConnection(connectorId) (src/lib/server-fns.js):
- A dedicated
getWorkspaceConnection(connectorId)method is called with the connector’sidas a string — NOTgetConnection, which is reserved for platform-shared connectors keyed by"<integration_type>". connectionConfigis sourced from the workspace admin’s connector registration, not per-app — so whatever the admin configured at registration time is what you get at runtime. </byo_shared_connectors>
id, the connectorId below. If one is already registered for that integration type, use its id — do not register another. Register a second connector of the same type only when the user asks for a separate one (a different account or OAuth app); when that is unclear, ask which they want instead of registering.
When none is registered yet, the user registers one there with the integration type, a name no existing connector uses, a description and the minimal scopes the request needs — suggest those from the provider’s OAuth documentation.
When implementing app-user connector functionality:
- Connector: Use the connector already registered for that integration type; the user registers a new one only when none exists.
- Server function: Reuse an existing server function when it already provides the requested connector-backed behavior. If none does, add one (
createServerFninsrc/lib/server-fns.js) that usescontext.getBase44().asServiceRole.connectors.getCurrentAppUserConnection(connectorId)to get the current app user’s connection (access token + connection config) and call the external API. Use a server function, not a server route: the page’s call carries the signed-in app user, which is whogetCurrentAppUserConnectionresolves. - Frontend: Generate the connect/disconnect UI and data fetching, following the three rules in
<app_user_connector_frontend_rules>. Use the connector’sidas theconnectorId. - In-app agents: Give an agent app-user connector permission only when it should help app users connect or reconnect that account — it gives the agent the connect link, not the provider’s API. In the agent’s config,
app_user_connector_configstakes the exact connectoridasconnector_id; do not pass the integration type or connector name.
id in the dashboard) — NOT the integration type.
SDK methods:
connectAppUser(connectorId)— returns a URL string. Open it so the app user can complete OAuth consent.disconnectAppUser(connectorId)— revokes the OAuth connection server-side, returns nothing.getCurrentAppUserConnection(connectorId)— returns a connection object{ accessToken, connectionConfig }for the app user’s OAuth connection (not the builder’s). DestructureaccessTokenand optionallyconnectionConfig(e.g.const { accessToken, connectionConfig } = await ...getCurrentAppUserConnection(connectorId)).connectionConfigmay contain connector-specific parameters (e.g. subdomain, workspace URL) — it holds the admin-entered fields (connection_config_fieldsfromlist_connectorsnames them) plus any the provider returned at connection time, such as an API host or instance URL — when the provider’s API is per-account, take the host from it instead of hardcoding the default.
src/lib/server-fns.js):
connectAppUser() will fail if the app user is not signed in. Use base44.auth.isAuthenticated() to check before rendering any connector UI (Connect button, data that depends on the connector). If not authenticated, show a login button that calls base44.auth.redirectToLogin().
Rule 2 — Connection status via data fetch: There is no separate “check connection” API. Instead, call the server function that uses the connector on page load. It returns { connected: false } when the app user has not connected the account → show the Connect button; otherwise it returns the data. If it throws, something else failed (the provider errored, the network dropped) → show an error and keep the connection state — never send the user to reconnect for it. Extract this fetch as a reusable function — you will call it again in Rule 3.
Rule 3 — Auto-refresh after OAuth: The OAuth flow opens in a new tab. When the user finishes and the tab closes, the original page doesn’t know. To fix this: use window.open() to keep a reference to the popup, then poll popup.closed — when it closes, call the reusable fetch from Rule 2 to refresh data automatically.
How the three rules connect (hooks/handlers skeleton):