@base44-preview/sdk 0.8.19-pr.135.d9d067f → 0.8.20-pr.136.28e7eab
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -181,13 +181,12 @@ export interface AuthModule {
|
|
|
181
181
|
* Initiates an OAuth login flow with one of the built-in providers. Requires a browser environment and can't be used in the backend.
|
|
182
182
|
*
|
|
183
183
|
* Supported providers:
|
|
184
|
-
* - `'google'
|
|
185
|
-
* - `'microsoft'
|
|
186
|
-
* - `'facebook'
|
|
187
|
-
* - `'apple'
|
|
188
|
-
* - `'sso'` - Enterprise SSO. Enable SSO in your app's authentication settings before using this provider.
|
|
184
|
+
* - `'google'`: {@link https://developers.google.com/identity/protocols/oauth2 | Google OAuth}. Enabled by default.
|
|
185
|
+
* - `'microsoft'`: {@link https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow | Microsoft OAuth}. Enable Microsoft in your app's authentication settings before specifying this provider.
|
|
186
|
+
* - `'facebook'`: {@link https://developers.facebook.com/docs/facebook-login | Facebook Login}. Enable Facebook in your app's authentication settings before using.
|
|
187
|
+
* - `'apple'`: {@link https://developer.apple.com/sign-in-with-apple/ | Sign in with Apple}. Enable Apple in your app's authentication settings before using this provider.
|
|
189
188
|
*
|
|
190
|
-
* @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`,
|
|
189
|
+
* @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`, or `'apple'`.
|
|
191
190
|
* @param fromUrl - URL to redirect to after successful authentication. Defaults to `'/'`.
|
|
192
191
|
*
|
|
193
192
|
* @example
|
|
@@ -208,11 +207,6 @@ export interface AuthModule {
|
|
|
208
207
|
* base44.auth.loginWithProvider('apple', '/dashboard');
|
|
209
208
|
* ```
|
|
210
209
|
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```typescript
|
|
213
|
-
* // SSO
|
|
214
|
-
* base44.auth.loginWithProvider('sso', '/dashboard');
|
|
215
|
-
* ```
|
|
216
210
|
*/
|
|
217
211
|
loginWithProvider(provider: string, fromUrl?: string): void;
|
|
218
212
|
/**
|
|
@@ -14,7 +14,6 @@ export function createConnectorsModule(axios, appId) {
|
|
|
14
14
|
*/
|
|
15
15
|
// @ts-expect-error Return type mismatch with interface - implementation returns string, interface expects string but implementation is typed as ConnectorAccessTokenResponse
|
|
16
16
|
async getAccessToken(integrationType) {
|
|
17
|
-
console.warn("[Base44 SDK] connectors.getAccessToken() is deprecated. Use getConnection(integrationType) and use the returned accessToken instead.");
|
|
18
17
|
if (!integrationType || typeof integrationType !== "string") {
|
|
19
18
|
throw new Error("Integration type is required and must be a string");
|
|
20
19
|
}
|
|
@@ -35,13 +35,42 @@ export interface ConnectorConnectionResponse {
|
|
|
35
35
|
/**
|
|
36
36
|
* Connectors module for managing OAuth tokens for external services.
|
|
37
37
|
*
|
|
38
|
-
* 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 or
|
|
38
|
+
* 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.
|
|
39
39
|
*
|
|
40
40
|
* Unlike the integrations module that provides pre-built functions, connectors give you
|
|
41
41
|
* raw OAuth tokens so you can call external service APIs directly with full control over
|
|
42
42
|
* the API calls you make. This is useful when you need custom API interactions that aren't
|
|
43
43
|
* covered by Base44's pre-built integrations.
|
|
44
44
|
*
|
|
45
|
+
* ## Available connectors
|
|
46
|
+
*
|
|
47
|
+
* All connectors work through [`getAccessToken()`](#getaccesstoken). Pass the integration type string and use the returned OAuth token to call the external service's API directly.
|
|
48
|
+
*
|
|
49
|
+
* | Service | Type identifier |
|
|
50
|
+
* |---|---|
|
|
51
|
+
* | Discord | `discord` |
|
|
52
|
+
* | GitHub | `github` |
|
|
53
|
+
* | Gmail | `gmail` |
|
|
54
|
+
* | Google BigQuery | `googlebigquery` |
|
|
55
|
+
* | Google Calendar | `googlecalendar` |
|
|
56
|
+
* | Google Docs | `googledocs` |
|
|
57
|
+
* | Google Drive | `googledrive` |
|
|
58
|
+
* | Google Sheets | `googlesheets` |
|
|
59
|
+
* | Google Slides | `googleslides` |
|
|
60
|
+
* | HubSpot | `hubspot` |
|
|
61
|
+
* | LinkedIn | `linkedin` |
|
|
62
|
+
* | Notion | `notion` |
|
|
63
|
+
* | Salesforce | `salesforce` |
|
|
64
|
+
* | Slack User | `slack` |
|
|
65
|
+
* | Slack Bot | `slackbot` |
|
|
66
|
+
* | TikTok | `tiktok` |
|
|
67
|
+
*
|
|
68
|
+
* Some connectors have dedicated setup guides: {@link https://docs.base44.com/Integrations/gmail-connector | Gmail}, {@link https://docs.base44.com/Integrations/linkedin-connector | LinkedIn}, and {@link https://docs.base44.com/Integrations/slack-connector | Slack} (covers both `slack` and `slackbot`).
|
|
69
|
+
*
|
|
70
|
+
* ### Slack User vs Slack Bot
|
|
71
|
+
*
|
|
72
|
+
* Base44 provides two Slack connectors: `slack` uses a user token and acts as the connected user, while `slackbot` uses a bot token with a customizable display name. Use `slack` when your app needs to read Slack data or act with a user's permissions. Use `slackbot` for sending automated messages as a branded bot. See the {@link https://docs.base44.com/Integrations/slack-connector | Slack connectors} guide for full details.
|
|
73
|
+
*
|
|
45
74
|
* ## Authentication Modes
|
|
46
75
|
*
|
|
47
76
|
* 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.
|
|
@@ -52,7 +81,7 @@ export interface ConnectorConnectionResponse {
|
|
|
52
81
|
*/
|
|
53
82
|
export interface ConnectorsModule {
|
|
54
83
|
/**
|
|
55
|
-
* Retrieves an OAuth access token for a specific external integration type.
|
|
84
|
+
* Retrieves an OAuth access token for a specific [external integration type](#available-connectors).
|
|
56
85
|
*
|
|
57
86
|
* @deprecated Use {@link getConnection} and use the returned `accessToken` (and `connectionConfig` when needed) instead.
|
|
58
87
|
*
|
|
@@ -60,7 +89,7 @@ export interface ConnectorsModule {
|
|
|
60
89
|
* has connected to. This token represents the connected app builder's account
|
|
61
90
|
* and can be used to make authenticated API calls to that external service on behalf of the app.
|
|
62
91
|
*
|
|
63
|
-
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`,
|
|
92
|
+
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, `'slackbot'`, `'github'`, or `'discord'`. See [Available connectors](#available-connectors) for the full list.
|
|
64
93
|
* @returns Promise resolving to the access token string.
|
|
65
94
|
*
|
|
66
95
|
* @example
|
|
@@ -82,8 +111,8 @@ export interface ConnectorsModule {
|
|
|
82
111
|
*
|
|
83
112
|
* @example
|
|
84
113
|
* ```typescript
|
|
85
|
-
* // Slack connection
|
|
86
|
-
* // Get Slack
|
|
114
|
+
* // Slack User connection
|
|
115
|
+
* // Get Slack user token and list channels
|
|
87
116
|
* const slackToken = await base44.asServiceRole.connectors.getAccessToken('slack');
|
|
88
117
|
*
|
|
89
118
|
* // List all public and private channels
|
|
@@ -95,6 +124,29 @@ export interface ConnectorsModule {
|
|
|
95
124
|
*
|
|
96
125
|
* const data = await slackResponse.json();
|
|
97
126
|
* ```
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* // Slack Bot connection
|
|
131
|
+
* // Get Slack bot token and post a message with a custom bot identity
|
|
132
|
+
* const botToken = await base44.asServiceRole.connectors.getAccessToken('slackbot');
|
|
133
|
+
*
|
|
134
|
+
* const response = await fetch('https://slack.com/api/chat.postMessage', {
|
|
135
|
+
* method: 'POST',
|
|
136
|
+
* headers: {
|
|
137
|
+
* 'Authorization': `Bearer ${botToken}`,
|
|
138
|
+
* 'Content-Type': 'application/json'
|
|
139
|
+
* },
|
|
140
|
+
* body: JSON.stringify({
|
|
141
|
+
* channel: '#alerts',
|
|
142
|
+
* text: 'Deployment to production completed successfully.',
|
|
143
|
+
* username: 'Deploy Bot',
|
|
144
|
+
* icon_emoji: ':rocket:'
|
|
145
|
+
* })
|
|
146
|
+
* });
|
|
147
|
+
*
|
|
148
|
+
* const result = await response.json();
|
|
149
|
+
* ```
|
|
98
150
|
*/
|
|
99
151
|
getAccessToken(integrationType: ConnectorIntegrationType): Promise<string>;
|
|
100
152
|
/**
|