23 lines
937 B
JavaScript
23 lines
937 B
JavaScript
/**
|
|
* Creates the Connectors module for the Base44 SDK.
|
|
*
|
|
* @param axios - Axios instance (should be service role client)
|
|
* @param appId - Application ID
|
|
* @returns Connectors module with methods to retrieve OAuth tokens
|
|
* @internal
|
|
*/
|
|
export function createConnectorsModule(axios, appId) {
|
|
return {
|
|
// Retrieve an OAuth access token for a specific external integration type
|
|
// @ts-expect-error Return type mismatch with interface - implementation returns object, interface expects string
|
|
async getAccessToken(integrationType) {
|
|
if (!integrationType || typeof integrationType !== "string") {
|
|
throw new Error("Integration type is required and must be a string");
|
|
}
|
|
const response = await axios.get(`/apps/${appId}/external-auth/tokens/${integrationType}`);
|
|
// @ts-expect-error
|
|
return response.access_token;
|
|
},
|
|
};
|
|
}
|