Skip to main content
Diese Seite ist Teil eines KI-Coding-Agent-Skills und für Agenten geschrieben, nicht für Menschen. Für die menschenlesbare Base44-Dokumentation siehe die Entwicklerdokumentation.

Connectors-Modul

OAuth-Token-Verwaltung für externe Dienste.
  • base44.asServiceRole.connectors — App-bezogene OAuth-Tokens (nur Backend/Service-Rolle). Alle Nutzer teilen dasselbe verbundene Konto.

Inhalt


Service Role Connectors (base44.asServiceRole.connectors)

App-bezogene OAuth-Tokens. Der App-Builder verbindet das Konto einmal; alle Nutzer teilen es. Nur Backend/Service-Rolle.

Methoden

MethodeSignaturBeschreibung
getConnection(integrationType)Promise<ConnectorConnectionResponse>Access-Token und optionale Verbindungskonfiguration holen
getAccessToken(integrationType)Promise<string>⚠️ Veraltet — verwende stattdessen getConnection()

Beispiele

// Backend function only
Deno.serve(async (req) => {
  const base44 = createClientFromRequest(req);

  // Recommended: use getConnection() for token + optional config
  const { accessToken, connectionConfig } = await base44.asServiceRole.connectors.getConnection("slack");

  const response = await fetch("https://slack.com/api/chat.postMessage", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${accessToken}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ channel: "#general", text: "Hello from Base44!" })
  });

  return Response.json(await response.json());
});
// Using connectionConfig (for services that need extra params, e.g. a subdomain)
const { accessToken, connectionConfig } = await base44.asServiceRole.connectors.getConnection("myservice");
const subdomain = connectionConfig?.subdomain;
const response = await fetch(`https://${subdomain}.example.com/api/v1/data`, {
  headers: { "Authorization": `Bearer ${accessToken}` }
});
// Google Calendar example
const { accessToken } = await base44.asServiceRole.connectors.getConnection("googlecalendar");

const events = await fetch(
  "https://www.googleapis.com/calendar/v3/calendars/primary/events?" +
  new URLSearchParams({ maxResults: "10", orderBy: "startTime", singleEvents: "true", timeMin: new Date().toISOString() }),
  { headers: { "Authorization": `Bearer ${accessToken}` } }
).then(r => r.json());

Verfügbare Dienste

DienstTyp-Kennung
Airtableairtable
Boxbox
ClickUpclickup
Discorddiscord
Dropboxdropbox
GitHubgithub
Gmailgmail
Google Analyticsgoogle_analytics
Google BigQuerygooglebigquery
Google Calendargooglecalendar
Google Classroomgoogle_classroom
Google Docsgoogledocs
Google Drivegoogledrive
Google Search Consolegoogle_search_console
Google Sheetsgooglesheets
Google Slidesgoogleslides
HubSpothubspot
Linearlinear
LinkedInlinkedin
Microsoft Teamsmicrosoft_teams
Microsoft OneDriveone_drive
Notionnotion
Outlookoutlook
Salesforcesalesforce
SharePointshare_point
Slack Userslack
Slack Botslackbot
Splitwisesplitwise
TikToktiktok
Typeformtypeform
Wixwix
Wrikewrike
Führe npx base44 connectors list-available in der CLI aus, um alle verfügbaren Typen zu sehen.

Setup-Anforderungen

  1. Builder-Tarif oder höher
  2. Backend-Funktionen aktiviert (für Service-Rollen-Connectors)
  3. Connector im Base44-Dashboard konfiguriert (OAuth-Flow abgeschlossen)

Wichtige Hinweise

  • Service-Rollen-Connectors: Ein Konto pro Connector pro App — alle Nutzer teilen dasselbe verbundene Konto
  • Du machst die API-Aufrufe: Base44 liefert den Token; du machst die eigentlichen API-Anfragen
  • Token-Refresh: Base44 aktualisiert den Token automatisch

Type Definitions

/**
 * The type of external integration/connector (for service role connectors).
 * Examples: 'googlecalendar', 'slack', 'github', 'notion', etc.
 */
type ConnectorIntegrationType = string;

/** Connection details returned by getConnection(). */
interface ConnectorConnectionResponse {
  /** The OAuth access token for the external service. */
  accessToken: string;
  /** Key-value configuration for the connection, or null if not needed. */
  connectionConfig: Record<string, string> | null;
}

/** Service role connectors module (app-scoped OAuth). Backend only. */
interface ConnectorsModule {
  /**
   * Retrieves the OAuth access token and optional connection config.
   * @param integrationType - e.g., 'googlecalendar', 'slack', 'github'.
   */
  getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;

  /**
   * @deprecated Use getConnection() instead.
   * Retrieves only the OAuth access token string.
   */
  getAccessToken(integrationType: ConnectorIntegrationType): Promise<string>;
}

Diese Seite wurde mit KI übersetzt. Für die genauesten und aktuellsten Informationen siehe die englische Version.