Skip to main content

Overview

Connectors module for managing OAuth tokens for external services. This module allows you to retrieve OAuth access tokens for external services that the app has connected to. Connectors are app-scoped. When an app builder connects an integration like Google Calendar, Slack, or GitHub, all users of the app share that same connection. Unlike the integrations module that provides pre-built functions, connectors give you raw OAuth tokens so you can call external service APIs directly with full control over the API calls you make. This is useful when you need custom API interactions that aren’t covered by Base44’s pre-built integrations.

Available connectors

All connectors work through getConnection(). Pass the integration type string and use the returned OAuth token to call the external service’s API directly.
ServiceType identifier
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
Notionnotion
Outlookoutlook
Salesforcesalesforce
SharePointshare_point
Slack Userslack
Slack Botslackbot
Splitwisesplitwise
TikToktiktok
Wixwix
Wrikewrike
See the integration guides for more details:

Authentication Modes

This module is only available to use with a client in service role authentication mode, which means it can only be used in backend environments.

Dynamic Types

If you’re working in a TypeScript project, you can generate types from your app’s connector configurations to get autocomplete on integration type names when calling getConnection(). See the Dynamic Types guide to get started.

Methods

⚠️ getAccessToken()

Deprecated: Use getConnection instead.
getAccessToken(integrationType): Promise<string>
Retrieves an OAuth access token for a specific external integration type.

Parameters

integrationType
string
required
The type of integration, such as 'googlecalendar', 'slack', 'slackbot', 'github', or 'discord'. See Available connectors for the full list.

Returns

Promise<string> Promise resolving to the access token string.

Examples

// Get Google Calendar OAuth token and fetch upcoming events
const googleToken = await base44.asServiceRole.connectors.getAccessToken('googlecalendar');

// Fetch upcoming 10 events
const timeMin = new Date().toISOString();
const url = `https://www.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&singleEvents=true&timeMin=${timeMin}`;

const calendarResponse = await fetch(url, {
  headers: { 'Authorization': `Bearer ${googleToken}` }
});

const events = await calendarResponse.json();

getConnection()

getConnection(integrationType): Promise<ConnectorConnectionResponse>
Retrieves the OAuth access token and connection configuration for a specific external integration type. Some connectors require connection-specific parameters to build API calls. In such cases, the returned connectionConfig is an object with the additional parameters. If there are no extra parameters needed for the connection, the connectionConfig is null. For example, a service might need a subdomain to construct the API URL in the form of {subdomain}.example.com. In such a case the subdomain will be available as a property of the connectionConfig object.

Parameters

integrationType
string
required
The type of integration, such as 'googlecalendar', 'slack', 'slackbot', 'github', or 'discord'. See Available connectors for the full list.

Returns

ConnectorConnectionResponse Connection details.
accessToken
string
required
The OAuth access token for the external service.
connectionConfig
Record<string, string> | null
required
Key-value configuration for the connection, or null if the connector does not provide one.

Examples

// Get Google Calendar OAuth token and fetch upcoming events
const { accessToken } = await base44.asServiceRole.connectors.getConnection('googlecalendar');

const timeMin = new Date().toISOString();
const url = `https://www.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&singleEvents=true&timeMin=${timeMin}`;

const calendarResponse = await fetch(url, {
  headers: { Authorization: `Bearer ${accessToken}` }
});

const events = await calendarResponse.json();

Type Definitions

ConnectorIntegrationType


ConnectorIntegrationType = keyof ConnectorIntegrationTypeRegistry extends never ? string : keyof ConnectorIntegrationTypeRegistry
Union of all connector integration type names from the ConnectorIntegrationTypeRegistry. Defaults to string when no types have been generated.

Example

// With generated types, you get autocomplete on integration types
const connection = await base44.asServiceRole.connectors.getConnection('googlecalendar');
const token = connection.accessToken;

ConnectorIntegrationTypeRegistry


Registry of connector integration type names. The types generate command fills this registry, then ConnectorIntegrationType resolves to a union of the keys.