Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Fix: Auth Config creation/updation (#1825)

Musthaq Ahamad1664c3424549
diff --git a/.changeset/bright-turtles-notice.md b/.changeset/bright-turtles-notice.md
new file mode 100644
index 000000000..bd5c3c074
--- /dev/null
+++ b/.changeset/bright-turtles-notice.md
@@ -0,0 +1,13 @@
+---
+'@composio/core': patch
+'@composio/anthropic': patch
+'@composio/cloudflare': patch
+'@composio/google': patch
+'@composio/langchain': patch
+'@composio/mastra': patch
+'@composio/openai': patch
+'@composio/openai-agents': patch
+'@composio/vercel': patch
+---
+
+Fix auth config creation/updation methods to accept tool access configs
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 038e7e1f8..a60733dd3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -208,7 +208,7 @@ importers:
devDependencies:
'@cloudflare/vitest-pool-workers':
specifier: ^0.8.19
+ version: 0.8.44(@cloudflare/[email protected])(@vitest/[email protected])(@vitest/[email protected])([email protected])
typescript:
specifier: ^5.5.2
version: 5.8.3
@@ -589,7 +589,7 @@ importers:
version: 0.85.2([email protected])
'@effect/vitest':
specifier: ^0.23.8
'@types/bun':
specifier: ^1.2.16
version: 1.2.16
@@ -618,8 +618,8 @@ importers:
ts/packages/core:
dependencies:
'@composio/client':
- specifier: 0.1.0-alpha.29
- version: 0.1.0-alpha.29
+ specifier: 0.1.0-alpha.30
+ version: 0.1.0-alpha.30
'@composio/json-schema-to-zod':
specifier: 0.1.11
version: 0.1.11
@@ -744,7 +744,7 @@ importers:
dependencies:
'@langchain/core':
specifier: ^0.3.63
devDependencies:
'@composio/core':
specifier: workspace:*
@@ -1213,6 +1213,9 @@ packages:
'@composio/[email protected]':
resolution: {integrity: sha512-0oI38Kl8LVEK/fFF7rTdvO11uwSWHzavTTUWE/ExnhIoik3wmHse1CRKywb06M+hkLO4+Vdkh46sXbNFs7YZyQ==}
+ '@composio/[email protected]':
+ resolution: {integrity: sha512-Vx8jrNdbNCY7072gW46HykR2Llr00XIwMF+Ys/A69+DViHGWeTpI5zlH9fycjmU3E1GnKpbIbhsF+gP41F2m+Q==}
+
'@composio/[email protected]':
resolution: {integrity: sha512-6gcCof9xqLhmmHSCvWLW/E16PKr5C1dWJ9AOk4FJU8JA7gSt8JEdFHBwx80dyprBJdwPF6R54nlkmpXrEwApzg==}
@@ -7236,7 +7239,7 @@ snapshots:
optionalDependencies:
workerd: 1.20250726.0
dependencies:
'@vitest/runner': 3.2.4
'@vitest/snapshot': 3.2.4
@@ -7287,6 +7290,8 @@ snapshots:
'@composio/[email protected]': {}
+ '@composio/[email protected]': {}
+
'@composio/[email protected]':
dependencies:
'@types/json-schema': 7.0.15
@@ -7410,7 +7415,7 @@ snapshots:
dependencies:
effect: 3.16.16
dependencies:
effect: 3.16.16
@@ -7985,14 +7990,14 @@ snapshots:
transitivePeerDependencies:
- openai
dependencies:
'@cfworker/json-schema': 4.1.1
ansi-styles: 5.2.0
camelcase: 6.3.0
decamelize: 1.2.0
js-tiktoken: 1.0.20
mustache: 4.2.0
p-queue: 6.6.2
p-retry: 4.6.2
@@ -9788,7 +9793,7 @@ snapshots:
sirv: 3.0.1
tinyglobby: 0.2.14
tinyrainbow: 2.0.0
'@vitest/[email protected]':
dependencies:
@@ -11266,7 +11271,7 @@ snapshots:
optionalDependencies:
dependencies:
'@types/uuid': 10.0.0
chalk: 4.1.2
diff --git a/ts/examples/connected-accounts/src/index.ts b/ts/examples/connected-accounts/src/index.ts
index 102b5d401..69780a2dd 100644
--- a/ts/examples/connected-accounts/src/index.ts
+++ b/ts/examples/connected-accounts/src/index.ts
@@ -38,3 +38,7 @@ const tools = await composio.tools.get('default', {
});
console.log(tools);
+
+const authConfigDetails = await composio.authConfigs.get(authConfig.id);
+
+console.log({ authConfigDetails });
\ No newline at end of file
diff --git a/ts/packages/core/package.json b/ts/packages/core/package.json
index b65edb56f..587052e97 100644
--- a/ts/packages/core/package.json
+++ b/ts/packages/core/package.json
@@ -44,7 +44,7 @@
"vitest": "^3.1.4"
},
"dependencies": {
- "@composio/client": "0.1.0-alpha.29",
+ "@composio/client": "0.1.0-alpha.30",
"@composio/json-schema-to-zod": "0.1.11",
"@types/json-schema": "^7.0.15",
"chalk": "^4.1.2",
diff --git a/ts/packages/core/src/models/AuthConfigs.ts b/ts/packages/core/src/models/AuthConfigs.ts
index 1368f6536..c4a32d5d2 100644
--- a/ts/packages/core/src/models/AuthConfigs.ts
+++ b/ts/packages/core/src/models/AuthConfigs.ts
@@ -133,17 +133,29 @@ export class AuthConfigs {
name: parsedOptions.data.name,
authScheme: parsedOptions.data.authScheme,
credentials: parsedOptions.data.credentials,
- tool_access_config: {
- tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools,
- },
+ proxy_config: parsedOptions.data.proxyConfig
+ ? {
+ proxy_url: parsedOptions.data.proxyConfig.proxyUrl,
+ proxy_auth_key: parsedOptions.data.proxyConfig.proxyAuthKey,
+ }
+ : undefined,
+ tool_access_config: parsedOptions.data.toolAccessConfig
+ ? {
+ tools_for_connected_account_creation:
+ parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation,
+ }
+ : undefined,
}
: {
type: parsedOptions.data.type,
credentials: parsedOptions.data.credentials,
name: parsedOptions.data.name,
- tool_access_config: {
- tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools,
- },
+ tool_access_config: parsedOptions.data.toolAccessConfig
+ ? {
+ tools_for_connected_account_creation:
+ parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation,
+ }
+ : undefined,
},
});
return transformCreateAuthConfigResponse(result);
@@ -217,14 +229,22 @@ export class AuthConfigs {
type: 'custom',
credentials: parsedData.data.credentials,
tool_access_config: {
- tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools,
+ tools_for_connected_account_creation:
+ parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
+ tools_available_for_execution:
+ parsedData.data.toolAccessConfig?.toolsAvailableForExecution ??
+ parsedData.data.restrictToFollowingTools,
},
}
: {
type: 'default',
scopes: parsedData.data.scopes,
tool_access_config: {
- tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools,
+ tools_for_connected_account_creation:
+ parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
+ tools_available_for_execution:
+ parsedData.data.toolAccessConfig?.toolsAvailableForExecution ??
+ parsedData.data.restrictToFollowingTools,
},
}
);
diff --git a/ts/packages/core/src/types/authConfigs.types.ts b/ts/packages/core/src/types/authConfigs.types.ts
index 41fb8858c..f9e010f44 100644
--- a/ts/packages/core/src/types/authConfigs.types.ts
+++ b/ts/packages/core/src/types/authConfigs.types.ts
@@ -21,6 +21,15 @@ export const AuthSchemeTypes = {
} as const;
export type AuthSchemeType = (typeof AuthSchemeTypes)[keyof typeof AuthSchemeTypes];
+export const AuthConfigCreationToolAccessConfigSchema = z.object({
+ toolsForConnectedAccountCreation: z.array(z.string()).optional(),
+});
+
+export const AuthConfigToolAccessConfigSchema = z.object({
+ toolsAvailableForExecution: z.array(z.string()).optional(),
+ toolsForConnectedAccountCreation: z.array(z.string()).optional(),
+});
+
export const AuthSchemeEnum = z.enum([
'OAUTH2',
'OAUTH1',
@@ -39,14 +48,20 @@ export const CreateCustomAuthConfigParamsSchema = z.object({
name: z.string().optional(),
credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])),
authScheme: AuthSchemeEnum,
- restrictToFollowingTools: z.array(z.string()).optional(),
+ proxyConfig: z
+ .object({
+ proxyUrl: z.string(),
+ proxyAuthKey: z.string().optional(),
+ })
+ .optional(),
+ toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
});
export const CreateComposioManagedAuthConfigParamsSchema = z.object({
type: z.literal('use_composio_managed_auth'),
name: z.string().optional(),
credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
- restrictToFollowingTools: z.array(z.string()).optional(),
+ toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
});
/**
@@ -80,11 +95,15 @@ export const AuthConfigRetrieveResponseSchema = z.object({
authScheme: AuthSchemeEnum.optional(),
credentials: z.record(z.string(), z.unknown()).optional(),
expectedInputFields: z.array(z.unknown()).optional(),
+ /**
+ * @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
+ */
restrictToFollowingTools: z.array(z.string()).optional(),
isComposioManaged: z.boolean().optional(),
createdBy: z.string().optional(),
createdAt: z.string().optional(),
lastUpdatedAt: z.string().optional(),
+ toolAccessConfig: AuthConfigToolAccessConfigSchema.optional(),
});
export type AuthConfigRetrieveResponse = z.infer<typeof AuthConfigRetrieveResponseSchema>;
@@ -106,13 +125,21 @@ export type AuthConfigListResponse = z.infer<typeof AuthConfigListResponseSchema
export const AuthCustomConfigUpdateParamsSchema = z.object({
credentials: z.record(z.string(), z.union([z.string(), z.unknown()])),
type: z.literal('custom'),
+ /**
+ * @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
+ */
restrictToFollowingTools: z.array(z.string()).optional(),
+ toolAccessConfig: AuthConfigToolAccessConfigSchema.optional(),
});
export const AuthDefaultConfigUpdateParamsSchema = z.object({
scopes: z.string(),
type: z.literal('default'),
+ /**
+ * @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
+ */
restrictToFollowingTools: z.array(z.string()).optional(),
+ toolAccessConfig: AuthConfigToolAccessConfigSchema.optional(),
});
export const AuthConfigUpdateParamsSchema = z.discriminatedUnion('type', [
diff --git a/ts/packages/core/src/types/connectedAccountAuthStates.types.ts b/ts/packages/core/src/types/connectedAccountAuthStates.types.ts
index c9d4b83e6..fe368cfbf 100644
--- a/ts/packages/core/src/types/connectedAccountAuthStates.types.ts
+++ b/ts/packages/core/src/types/connectedAccountAuthStates.types.ts
@@ -66,6 +66,8 @@ const BaseSchemeRaw = z
api_key: z.string().optional(),
// for generic api key
generic_api_key: z.string().optional(),
+ // for bearer token
+ bearer_token: z.string().optional(),
})
.catchall(z.unknown());
@@ -93,7 +95,7 @@ export const Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSc
token_type: z.string().optional(),
refresh_token: z.string().nullish(),
expires_in: z.union([z.string(), z.number(), z.null()]).optional(),
- scope: z.union([z.string(), z.array(z.string())]).optional(),
+ scope: z.union([z.string(), z.array(z.string()), z.null()]).optional(),
// previously verification_token, will be sent as verification_token to slack
webhook_signature: z.string().optional(),
authed_user: z
diff --git a/ts/packages/core/src/types/toolkit.types.ts b/ts/packages/core/src/types/toolkit.types.ts
index 189a267d6..b261e94e9 100644
--- a/ts/packages/core/src/types/toolkit.types.ts
+++ b/ts/packages/core/src/types/toolkit.types.ts
@@ -90,6 +90,8 @@ export const ToolkitRetrieveResponseSchema = z.object({
isLocalToolkit: z.boolean(),
composioManagedAuthSchemes: z.array(z.string()).optional(),
authConfigDetails: z.array(ToolkitAuthConfigDetailsSchema).optional(),
+ baseUrl: z.string().optional(),
+ getCurrentUserEndpoint: z.string().optional(),
});
export type ToolkitAuthField = z.infer<typeof ToolkitAuthFieldSchema>;
diff --git a/ts/packages/core/src/utils/transformers/authConfigs.ts b/ts/packages/core/src/utils/transformers/authConfigs.ts
index 6678ed0fd..1cb3e5e8a 100644
--- a/ts/packages/core/src/utils/transformers/authConfigs.ts
+++ b/ts/packages/core/src/utils/transformers/authConfigs.ts
@@ -49,6 +49,13 @@ export function transformAuthConfigRetrieveResponse(
createdAt: authConfig.created_at,
lastUpdatedAt: authConfig.last_updated_at,
restrictToFollowingTools: authConfig.tool_access_config?.tools_for_connected_account_creation,
+ toolAccessConfig: authConfig.tool_access_config
+ ? {
+ toolsAvailableForExecution: authConfig.tool_access_config.tools_available_for_execution,
+ toolsForConnectedAccountCreation:
+ authConfig.tool_access_config.tools_for_connected_account_creation,
+ }
+ : undefined,
}));
}
diff --git a/ts/packages/core/src/utils/transformers/toolkits.ts b/ts/packages/core/src/utils/transformers/toolkits.ts
index 8680eb05b..03e778559 100644
--- a/ts/packages/core/src/utils/transformers/toolkits.ts
+++ b/ts/packages/core/src/utils/transformers/toolkits.ts
@@ -77,6 +77,8 @@ export const transformToolkitRetrieveResponse = (
baseUrl: authConfig.proxy?.base_url,
},
})),
+ baseUrl: response.base_url,
+ getCurrentUserEndpoint: response.get_current_user_endpoint,
}));
};
diff --git a/ts/packages/core/test/AuthConfigs/authConfigs.test.ts b/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
index ae080fa7c..8c0da3585 100644
--- a/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
+++ b/ts/packages/core/test/AuthConfigs/authConfigs.test.ts
@@ -70,6 +70,11 @@ const mockTransformedAuthConfigResponse = {
createdBy: 'user_123',
createdAt: '2023-01-01T00:00:00Z',
lastUpdatedAt: '2023-01-01T00:00:00Z',
+ restrictToFollowingTools: undefined,
+ toolAccessConfig: {
+ toolsAvailableForExecution: undefined,
+ toolsForConnectedAccountCreation: undefined,
+ },
};
// Extended mock client with all AuthConfigs methods
@@ -260,9 +265,9 @@ describe('AuthConfigs', () => {
},
auth_config: {
type: 'use_composio_managed_auth',
- tool_access_config: {
- tools_for_connected_account_creation: undefined,
- },
+ credentials: undefined,
+ name: undefined,
+ tool_access_config: undefined,
},
});
@@ -302,7 +307,17 @@ describe('AuthConfigs', () => {
toolkit: {
slug: 'github',
},
- auth_config: options,
+ auth_config: {
+ type: 'use_custom_auth',
+ name: 'Custom GitHub Auth',
+ authScheme: 'OAUTH2',
+ credentials: {
+ client_id: 'test_client_id',
+ client_secret: 'test_client_secret',
+ },
+ proxy_config: undefined,
+ tool_access_config: undefined,
+ },
});
expect(result).toEqual({
@@ -333,7 +348,14 @@ describe('AuthConfigs', () => {
toolkit: {
slug: 'github',
},
- auth_config: options,
+ auth_config: {
+ type: 'use_composio_managed_auth',
+ credentials: {
+ custom_field: 'value',
+ },
+ name: 'My GitHub Config',
+ tool_access_config: undefined,
+ },
});
expect(result).toEqual({
diff --git a/ts/packages/core/test/models/toolkits.test.ts b/ts/packages/core/test/models/toolkits.test.ts
index 04da3646d..5d4de7461 100644
--- a/ts/packages/core/test/models/toolkits.test.ts
+++ b/ts/packages/core/test/models/toolkits.test.ts
@@ -316,10 +316,9 @@ describe('Toolkits', () => {
},
auth_config: {
type: 'use_composio_managed_auth',
+ credentials: undefined,
name: 'Test Toolkit Auth Config',
- tool_access_config: {
- tools_for_connected_account_creation: undefined,
- },
+ tool_access_config: undefined,
},
});
expect(mockClient.connectedAccounts.create).toHaveBeenCalledWith({