Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.base44.com/llms.txt

Use this file to discover all available pages before exploring further.

You’re viewing developer documentation
This documentation is for developers working with the Base44 developer platform. For information about connectors in the app editor, see Using Connectors.
App user connectors let each signed-in app user connect their own third-party account. Each app user gets their own OAuth token. Use this when actions need to happen as the individual app user, like sending email from their Gmail account, posting to their personal LinkedIn, or reading their own Google Calendar events. Unlike shared connectors, where one account is shared across all app users, app user connectors store a separate OAuth token per user. The OAuth flow runs under your registered OAuth application, so app users see your app’s name on the provider’s consent screen.
App user connectors require a Builder plan or higher.

Set up

Before app users can connect their accounts, register your OAuth app credentials in your workspace. This requires workspace admin access. You also need a client ID and client secret from the external service. Register the connector from your Workspace Settings. See Setting up connectors for app users for step-by-step instructions. After you register the connector, the workspace assigns it an ID. Use that ID to connect and disconnect app users in your frontend code and retrieve their tokens in your backend functions.

Connect and disconnect in your frontend

Use base44.connectors in your frontend code to start and end the OAuth flow for each app user. To connect an app user, call connectAppUser with the connector ID. It returns a redirect URL. Navigate the app user to that URL to start the OAuth flow.
const redirectUrl = await base44.connectors.connectAppUser("YOUR_CONNECTOR_ID");
window.location.href = redirectUrl;
After the app user completes the flow, their token is stored and your backend functions can retrieve it.
To disconnect an app user, call disconnectAppUser with the connector ID. It removes the stored token for the currently signed-in app user.
await base44.connectors.disconnectAppUser("YOUR_CONNECTOR_ID");

Retrieve the token in a backend function

Use createClientFromRequest() to create the SDK client in your backend function. It reads the app user’s identity from the incoming request automatically, so the SDK knows which user’s token to return. Then call getCurrentAppUserConnection() with the connector ID to retrieve the token for the app user making the current request.
import { createClientFromRequest } from "@base44/sdk";

export default async function handler(req: Request) {
  const base44 = createClientFromRequest(req);

  const { accessToken } =
    await base44.asServiceRole.connectors.getCurrentAppUserConnection(
      "YOUR_CONNECTOR_ID",
    );

  const response = await fetch(
    "https://www.googleapis.com/calendar/v3/calendars/primary/events",
    {
      headers: { Authorization: `Bearer ${accessToken}` },
    },
  );

  const events = await response.json();
  return Response.json(events);
}

See also