@base44-preview/sdk 0.8.20-pr.130.5fded09 → 0.8.20-pr.130.9ca04bf
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.
|
@@ -45,22 +45,21 @@ export function createConnectorsModule(axios, appId) {
|
|
|
45
45
|
*/
|
|
46
46
|
export function createUserConnectorsModule(axios, appId) {
|
|
47
47
|
return {
|
|
48
|
-
|
|
49
|
-
async getAppUserAccessToken(connectorId) {
|
|
48
|
+
async getCurrentAppUserAccessToken(connectorId) {
|
|
50
49
|
if (!connectorId || typeof connectorId !== "string") {
|
|
51
50
|
throw new Error("Connector ID is required and must be a string");
|
|
52
51
|
}
|
|
53
52
|
const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${connectorId}/token`);
|
|
54
|
-
|
|
55
|
-
return
|
|
53
|
+
const data = response;
|
|
54
|
+
return data.access_token;
|
|
56
55
|
},
|
|
57
56
|
async connectAppUser(connectorId) {
|
|
58
57
|
if (!connectorId || typeof connectorId !== "string") {
|
|
59
58
|
throw new Error("Connector ID is required and must be a string");
|
|
60
59
|
}
|
|
61
60
|
const response = await axios.post(`/apps/${appId}/app-user-auth/connectors/${connectorId}/initiate`);
|
|
62
|
-
|
|
63
|
-
return
|
|
61
|
+
const data = response;
|
|
62
|
+
return data.redirect_url;
|
|
64
63
|
},
|
|
65
64
|
async disconnectAppUser(connectorId) {
|
|
66
65
|
if (!connectorId || typeof connectorId !== "string") {
|
|
@@ -32,12 +32,6 @@ export interface ConnectorConnectionResponse {
|
|
|
32
32
|
/** Key-value configuration for the connection, or `null` if the connector does not provide one. */
|
|
33
33
|
connectionConfig: Record<string, string> | null;
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Response from the connectors initiate endpoint.
|
|
37
|
-
*/
|
|
38
|
-
export interface ConnectorInitiateResponse {
|
|
39
|
-
redirect_url: string;
|
|
40
|
-
}
|
|
41
35
|
/**
|
|
42
36
|
* Connectors module for managing app-scoped OAuth tokens for external services.
|
|
43
37
|
*
|
|
@@ -255,14 +249,14 @@ export interface UserConnectorsModule {
|
|
|
255
249
|
* @example
|
|
256
250
|
* ```typescript
|
|
257
251
|
* // Get the end user's access token for a connector
|
|
258
|
-
* const token = await base44.connectors.
|
|
252
|
+
* const token = await base44.connectors.getCurrentAppUserAccessToken('abc123def');
|
|
259
253
|
*
|
|
260
254
|
* const response = await fetch('https://www.googleapis.com/calendar/v3/calendars/primary/events', {
|
|
261
255
|
* headers: { 'Authorization': `Bearer ${token}` }
|
|
262
256
|
* });
|
|
263
257
|
* ```
|
|
264
258
|
*/
|
|
265
|
-
|
|
259
|
+
getCurrentAppUserAccessToken(connectorId: string): Promise<string>;
|
|
266
260
|
/**
|
|
267
261
|
* Initiates the app-user OAuth flow for a specific connector.
|
|
268
262
|
*
|