Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/composio/connectors/__tests__/getConnectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("getConnectors", () => {

expect(getComposioClient).toHaveBeenCalled();
expect(mockComposio.create).toHaveBeenCalledWith("account-123", {
toolkits: ["googlesheets", "googledrive", "googledocs", "tiktok"],
toolkits: ["googlesheets", "googledrive", "googledocs", "tiktok", "instagram"],
});
expect(result).toEqual([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ describe("isAllowedArtistConnector", () => {
expect(isAllowedArtistConnector("tiktok")).toBe(true);
});

it("should return true for 'instagram'", () => {
expect(isAllowedArtistConnector("instagram")).toBe(true);
});

it("should return false for connectors not in ALLOWED_ARTIST_CONNECTORS", () => {
expect(isAllowedArtistConnector("googlesheets")).toBe(false);
expect(isAllowedArtistConnector("googledrive")).toBe(false);
expect(isAllowedArtistConnector("instagram")).toBe(false);
expect(isAllowedArtistConnector("random")).toBe(false);
});

Expand All @@ -24,8 +27,9 @@ describe("isAllowedArtistConnector", () => {
});

describe("ALLOWED_ARTIST_CONNECTORS", () => {
it("should include tiktok", () => {
it("should include tiktok and instagram", () => {
expect(ALLOWED_ARTIST_CONNECTORS).toContain("tiktok");
expect(ALLOWED_ARTIST_CONNECTORS).toContain("instagram");
});

it("should be a readonly array", () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/composio/connectors/getConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ConnectorInfo {
* Passed explicitly to composio.create() because session.toolkits()
* only returns the first 20 by default.
*/
const SUPPORTED_TOOLKITS = ["googlesheets", "googledrive", "googledocs", "tiktok"];
const SUPPORTED_TOOLKITS = ["googlesheets", "googledrive", "googledocs", "tiktok", "instagram"];

/**
* Options for getting connectors.
Expand Down
2 changes: 1 addition & 1 deletion lib/composio/connectors/isAllowedArtistConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* List of toolkit slugs that artists are allowed to connect.
* Only these connectors will be shown in the artist-connectors API.
*/
export const ALLOWED_ARTIST_CONNECTORS = ["tiktok"] as const;
export const ALLOWED_ARTIST_CONNECTORS = ["tiktok", "instagram"] as const;

export type AllowedArtistConnector = (typeof ALLOWED_ARTIST_CONNECTORS)[number];

Expand Down
19 changes: 12 additions & 7 deletions lib/composio/connectors/validateAuthorizeConnectorRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ export async function validateAuthorizeConnectorRequest(
}
const { connector, callback_url, account_id } = validated;

// Build auth configs for custom OAuth
const authConfigs: Record<string, string> = {};
if (connector === "tiktok" && process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID) {
authConfigs.tiktok = process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID;
}
if (connector === "instagram" && process.env.COMPOSIO_INSTAGRAM_AUTH_CONFIG_ID) {
authConfigs.instagram = process.env.COMPOSIO_INSTAGRAM_AUTH_CONFIG_ID;
}
const resolvedAuthConfigs = Object.keys(authConfigs).length > 0 ? authConfigs : undefined;

// 3. If account_id is provided, verify access and use that entity
if (account_id) {
const accessResult = await checkAccountAccess(accountId, account_id);
Expand All @@ -60,17 +70,11 @@ export async function validateAuthorizeConnectorRequest(
);
}

// Build auth configs for custom OAuth
const authConfigs: Record<string, string> = {};
if (connector === "tiktok" && process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID) {
authConfigs.tiktok = process.env.COMPOSIO_TIKTOK_AUTH_CONFIG_ID;
}

return {
accountId: account_id,
connector,
callbackUrl: callback_url,
authConfigs: Object.keys(authConfigs).length > 0 ? authConfigs : undefined,
authConfigs: resolvedAuthConfigs,
};
}

Expand All @@ -79,5 +83,6 @@ export async function validateAuthorizeConnectorRequest(
accountId,
connector,
callbackUrl: callback_url,
authConfigs: resolvedAuthConfigs,
};
}
Loading