@devries-cameron20 / composio-1 / commits / 1664c3424
Fork 0

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 Ahamad committed Aug 5, 2025 at 16:23 UTC 1664c3424549ee0155dea165473adda355c35dc7
12 files changed +134 -31
.changeset/bright-turtles-notice.md new
+13
@@ -0,0 +1,13 @@
1 +---
2 +'@composio/core': patch
3 +'@composio/anthropic': patch
4 +'@composio/cloudflare': patch
5 +'@composio/google': patch
6 +'@composio/langchain': patch
7 +'@composio/mastra': patch
8 +'@composio/openai': patch
9 +'@composio/openai-agents': patch
10 +'@composio/vercel': patch
11 +---
12 +
13 +Fix auth config creation/updation methods to accept tool access configs
pnpm-lock.yaml
+16 -11
@@ -208,7 +208,7 @@ importers:
208 devDependencies:
209 '@cloudflare/vitest-pool-workers':
210 specifier: ^0.8.19
211 - version: 0.8.44(@cloudflare/workers-types@4.20250619.0)(@vitest/runner@3.2.4)(@vitest/snapshot@3.2.4)(vitest@3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
211 + version: 0.8.44(@cloudflare/workers-types@4.20250619.0)(@vitest/runner@3.2.4)(@vitest/snapshot@3.2.4)(vitest@3.2.4)
212 typescript:
213 specifier: ^5.5.2
214 version: 5.8.3
@@ -589,7 +589,7 @@ importers:
589 version: 0.85.2(effect@3.16.16)
590 '@effect/vitest':
591 specifier: ^0.23.8
592 - version: 0.23.8(effect@3.16.16)(vitest@3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))
592 + version: 0.23.8(effect@3.16.16)(vitest@3.2.4)
593 '@types/bun':
594 specifier: ^1.2.16
595 version: 1.2.16
@@ -618,8 +618,8 @@ importers:
618 ts/packages/core:
619 dependencies:
620 '@composio/client':
621 - specifier: 0.1.0-alpha.29
622 - version: 0.1.0-alpha.29
621 + specifier: 0.1.0-alpha.30
622 + version: 0.1.0-alpha.30
623 '@composio/json-schema-to-zod':
624 specifier: 0.1.11
625 version: 0.1.11
@@ -744,7 +744,7 @@ importers:
744 dependencies:
745 '@langchain/core':
746 specifier: ^0.3.63
747 - version: 0.3.63(openai@5.5.1(zod@3.25.67))
747 + version: 0.3.63(openai@5.5.1(ws@8.18.2)(zod@3.25.67))
748 devDependencies:
749 '@composio/core':
750 specifier: workspace:*
@@ -1213,6 +1213,9 @@ packages:
1213 '@composio/client@0.1.0-alpha.29':
1214 resolution: {integrity: sha512-0oI38Kl8LVEK/fFF7rTdvO11uwSWHzavTTUWE/ExnhIoik3wmHse1CRKywb06M+hkLO4+Vdkh46sXbNFs7YZyQ==}
1215
1216 + '@composio/client@0.1.0-alpha.30':
1217 + resolution: {integrity: sha512-Vx8jrNdbNCY7072gW46HykR2Llr00XIwMF+Ys/A69+DViHGWeTpI5zlH9fycjmU3E1GnKpbIbhsF+gP41F2m+Q==}
1218 +
1219 '@composio/json-schema-to-zod@0.1.11':
1220 resolution: {integrity: sha512-6gcCof9xqLhmmHSCvWLW/E16PKr5C1dWJ9AOk4FJU8JA7gSt8JEdFHBwx80dyprBJdwPF6R54nlkmpXrEwApzg==}
1221
@@ -7236,7 +7239,7 @@ snapshots:
7239 optionalDependencies:
7240 workerd: 1.20250726.0
7241
7239 - '@cloudflare/vitest-pool-workers@0.8.44(@cloudflare/workers-types@4.20250619.0)(@vitest/runner@3.2.4)(@vitest/snapshot@3.2.4)(vitest@3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
7242 + '@cloudflare/vitest-pool-workers@0.8.44(@cloudflare/workers-types@4.20250619.0)(@vitest/runner@3.2.4)(@vitest/snapshot@3.2.4)(vitest@3.2.4)':
7243 dependencies:
7244 '@vitest/runner': 3.2.4
7245 '@vitest/snapshot': 3.2.4
@@ -7287,6 +7290,8 @@ snapshots:
7290
7291 '@composio/client@0.1.0-alpha.29': {}
7292
7293 + '@composio/client@0.1.0-alpha.30': {}
7294 +
7295 '@composio/json-schema-to-zod@0.1.11':
7296 dependencies:
7297 '@types/json-schema': 7.0.15
@@ -7410,7 +7415,7 @@ snapshots:
7415 dependencies:
7416 effect: 3.16.16
7417
7413 - '@effect/vitest@0.23.8(effect@3.16.16)(vitest@3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0))':
7418 + '@effect/vitest@0.23.8(effect@3.16.16)(vitest@3.2.4)':
7419 dependencies:
7420 effect: 3.16.16
7421 vitest: 3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
@@ -7985,14 +7990,14 @@ snapshots:
7990 transitivePeerDependencies:
7991 - openai
7992
7988 - '@langchain/core@0.3.63(openai@5.5.1(zod@3.25.67))':
7993 + '@langchain/core@0.3.63(openai@5.5.1(ws@8.18.2)(zod@3.25.67))':
7994 dependencies:
7995 '@cfworker/json-schema': 4.1.1
7996 ansi-styles: 5.2.0
7997 camelcase: 6.3.0
7998 decamelize: 1.2.0
7999 js-tiktoken: 1.0.20
7995 - langsmith: 0.3.33(openai@5.5.1(zod@3.25.67))
8000 + langsmith: 0.3.33(openai@5.5.1(ws@8.18.2)(zod@3.25.67))
8001 mustache: 4.2.0
8002 p-queue: 6.6.2
8003 p-retry: 4.6.2
@@ -9788,7 +9793,7 @@ snapshots:
9793 sirv: 3.0.1
9794 tinyglobby: 0.2.14
9795 tinyrainbow: 2.0.0
9791 - vitest: 3.2.4(@types/node@22.15.32)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9796 + vitest: 3.2.4(@types/node@24.0.3)(@vitest/ui@3.2.4)(jiti@1.21.7)(tsx@4.20.3)(yaml@2.8.0)
9797
9798 '@vitest/utils@3.2.4':
9799 dependencies:
@@ -11266,7 +11271,7 @@ snapshots:
11271 optionalDependencies:
11272 openai: 4.104.0(ws@8.18.2)(zod@3.25.67)
11273
11269 - langsmith@0.3.33(openai@5.5.1(zod@3.25.67)):
11274 + langsmith@0.3.33(openai@5.5.1(ws@8.18.2)(zod@3.25.67)):
11275 dependencies:
11276 '@types/uuid': 10.0.0
11277 chalk: 4.1.2
ts/examples/connected-accounts/src/index.ts
+4
@@ -38,3 +38,7 @@ const tools = await composio.tools.get('default', {
38 });
39
40 console.log(tools);
41 +
42 +const authConfigDetails = await composio.authConfigs.get(authConfig.id);
43 +
44 +console.log({ authConfigDetails });
\ No newline at end of file
ts/packages/core/package.json
+1 -1
@@ -44,7 +44,7 @@
44 "vitest": "^3.1.4"
45 },
46 "dependencies": {
47 - "@composio/client": "0.1.0-alpha.29",
47 + "@composio/client": "0.1.0-alpha.30",
48 "@composio/json-schema-to-zod": "0.1.11",
49 "@types/json-schema": "^7.0.15",
50 "chalk": "^4.1.2",
ts/packages/core/src/models/AuthConfigs.ts
+28 -8
@@ -133,17 +133,29 @@ export class AuthConfigs {
133 name: parsedOptions.data.name,
134 authScheme: parsedOptions.data.authScheme,
135 credentials: parsedOptions.data.credentials,
136 - tool_access_config: {
137 - tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools,
138 - },
136 + proxy_config: parsedOptions.data.proxyConfig
137 + ? {
138 + proxy_url: parsedOptions.data.proxyConfig.proxyUrl,
139 + proxy_auth_key: parsedOptions.data.proxyConfig.proxyAuthKey,
140 + }
141 + : undefined,
142 + tool_access_config: parsedOptions.data.toolAccessConfig
143 + ? {
144 + tools_for_connected_account_creation:
145 + parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation,
146 + }
147 + : undefined,
148 }
149 : {
150 type: parsedOptions.data.type,
151 credentials: parsedOptions.data.credentials,
152 name: parsedOptions.data.name,
144 - tool_access_config: {
145 - tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools,
146 - },
153 + tool_access_config: parsedOptions.data.toolAccessConfig
154 + ? {
155 + tools_for_connected_account_creation:
156 + parsedOptions.data.toolAccessConfig.toolsForConnectedAccountCreation,
157 + }
158 + : undefined,
159 },
160 });
161 return transformCreateAuthConfigResponse(result);
@@ -217,14 +229,22 @@ export class AuthConfigs {
229 type: 'custom',
230 credentials: parsedData.data.credentials,
231 tool_access_config: {
220 - tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools,
232 + tools_for_connected_account_creation:
233 + parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
234 + tools_available_for_execution:
235 + parsedData.data.toolAccessConfig?.toolsAvailableForExecution ??
236 + parsedData.data.restrictToFollowingTools,
237 },
238 }
239 : {
240 type: 'default',
241 scopes: parsedData.data.scopes,
242 tool_access_config: {
227 - tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools,
243 + tools_for_connected_account_creation:
244 + parsedData.data.toolAccessConfig?.toolsForConnectedAccountCreation,
245 + tools_available_for_execution:
246 + parsedData.data.toolAccessConfig?.toolsAvailableForExecution ??
247 + parsedData.data.restrictToFollowingTools,
248 },
249 }
250 );
ts/packages/core/src/types/authConfigs.types.ts
+29 -2
@@ -21,6 +21,15 @@ export const AuthSchemeTypes = {
21 } as const;
22 export type AuthSchemeType = (typeof AuthSchemeTypes)[keyof typeof AuthSchemeTypes];
23
24 +export const AuthConfigCreationToolAccessConfigSchema = z.object({
25 + toolsForConnectedAccountCreation: z.array(z.string()).optional(),
26 +});
27 +
28 +export const AuthConfigToolAccessConfigSchema = z.object({
29 + toolsAvailableForExecution: z.array(z.string()).optional(),
30 + toolsForConnectedAccountCreation: z.array(z.string()).optional(),
31 +});
32 +
33 export const AuthSchemeEnum = z.enum([
34 'OAUTH2',
35 'OAUTH1',
@@ -39,14 +48,20 @@ export const CreateCustomAuthConfigParamsSchema = z.object({
48 name: z.string().optional(),
49 credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])),
50 authScheme: AuthSchemeEnum,
42 - restrictToFollowingTools: z.array(z.string()).optional(),
51 + proxyConfig: z
52 + .object({
53 + proxyUrl: z.string(),
54 + proxyAuthKey: z.string().optional(),
55 + })
56 + .optional(),
57 + toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
58 });
59
60 export const CreateComposioManagedAuthConfigParamsSchema = z.object({
61 type: z.literal('use_composio_managed_auth'),
62 name: z.string().optional(),
63 credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
49 - restrictToFollowingTools: z.array(z.string()).optional(),
64 + toolAccessConfig: AuthConfigCreationToolAccessConfigSchema.optional(),
65 });
66
67 /**
@@ -80,11 +95,15 @@ export const AuthConfigRetrieveResponseSchema = z.object({
95 authScheme: AuthSchemeEnum.optional(),
96 credentials: z.record(z.string(), z.unknown()).optional(),
97 expectedInputFields: z.array(z.unknown()).optional(),
98 + /**
99 + * @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
100 + */
101 restrictToFollowingTools: z.array(z.string()).optional(),
102 isComposioManaged: z.boolean().optional(),
103 createdBy: z.string().optional(),
104 createdAt: z.string().optional(),
105 lastUpdatedAt: z.string().optional(),
106 + toolAccessConfig: AuthConfigToolAccessConfigSchema.optional(),
107 });
108 export type AuthConfigRetrieveResponse = z.infer<typeof AuthConfigRetrieveResponseSchema>;
109
@@ -106,13 +125,21 @@ export type AuthConfigListResponse = z.infer<typeof AuthConfigListResponseSchema
125 export const AuthCustomConfigUpdateParamsSchema = z.object({
126 credentials: z.record(z.string(), z.union([z.string(), z.unknown()])),
127 type: z.literal('custom'),
128 + /**
129 + * @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
130 + */
131 restrictToFollowingTools: z.array(z.string()).optional(),
132 + toolAccessConfig: AuthConfigToolAccessConfigSchema.optional(),
133 });
134
135 export const AuthDefaultConfigUpdateParamsSchema = z.object({
136 scopes: z.string(),
137 type: z.literal('default'),
138 + /**
139 + * @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
140 + */
141 restrictToFollowingTools: z.array(z.string()).optional(),
142 + toolAccessConfig: AuthConfigToolAccessConfigSchema.optional(),
143 });
144
145 export const AuthConfigUpdateParamsSchema = z.discriminatedUnion('type', [
ts/packages/core/src/types/connectedAccountAuthStates.types.ts
+3 -1
@@ -66,6 +66,8 @@ const BaseSchemeRaw = z
66 api_key: z.string().optional(),
67 // for generic api key
68 generic_api_key: z.string().optional(),
69 + // for bearer token
70 + bearer_token: z.string().optional(),
71 })
72 .catchall(z.unknown());
73
@@ -93,7 +95,7 @@ export const Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSc
95 token_type: z.string().optional(),
96 refresh_token: z.string().nullish(),
97 expires_in: z.union([z.string(), z.number(), z.null()]).optional(),
96 - scope: z.union([z.string(), z.array(z.string())]).optional(),
98 + scope: z.union([z.string(), z.array(z.string()), z.null()]).optional(),
99 // previously verification_token, will be sent as verification_token to slack
100 webhook_signature: z.string().optional(),
101 authed_user: z
ts/packages/core/src/types/toolkit.types.ts
+2
@@ -90,6 +90,8 @@ export const ToolkitRetrieveResponseSchema = z.object({
90 isLocalToolkit: z.boolean(),
91 composioManagedAuthSchemes: z.array(z.string()).optional(),
92 authConfigDetails: z.array(ToolkitAuthConfigDetailsSchema).optional(),
93 + baseUrl: z.string().optional(),
94 + getCurrentUserEndpoint: z.string().optional(),
95 });
96
97 export type ToolkitAuthField = z.infer<typeof ToolkitAuthFieldSchema>;
ts/packages/core/src/utils/transformers/authConfigs.ts
+7
@@ -49,6 +49,13 @@ export function transformAuthConfigRetrieveResponse(
49 createdAt: authConfig.created_at,
50 lastUpdatedAt: authConfig.last_updated_at,
51 restrictToFollowingTools: authConfig.tool_access_config?.tools_for_connected_account_creation,
52 + toolAccessConfig: authConfig.tool_access_config
53 + ? {
54 + toolsAvailableForExecution: authConfig.tool_access_config.tools_available_for_execution,
55 + toolsForConnectedAccountCreation:
56 + authConfig.tool_access_config.tools_for_connected_account_creation,
57 + }
58 + : undefined,
59 }));
60 }
61
ts/packages/core/src/utils/transformers/toolkits.ts
+2
@@ -77,6 +77,8 @@ export const transformToolkitRetrieveResponse = (
77 baseUrl: authConfig.proxy?.base_url,
78 },
79 })),
80 + baseUrl: response.base_url,
81 + getCurrentUserEndpoint: response.get_current_user_endpoint,
82 }));
83 };
84
ts/packages/core/test/AuthConfigs/authConfigs.test.ts
+27 -5
@@ -70,6 +70,11 @@ const mockTransformedAuthConfigResponse = {
70 createdBy: 'user_123',
71 createdAt: '2023-01-01T00:00:00Z',
72 lastUpdatedAt: '2023-01-01T00:00:00Z',
73 + restrictToFollowingTools: undefined,
74 + toolAccessConfig: {
75 + toolsAvailableForExecution: undefined,
76 + toolsForConnectedAccountCreation: undefined,
77 + },
78 };
79
80 // Extended mock client with all AuthConfigs methods
@@ -260,9 +265,9 @@ describe('AuthConfigs', () => {
265 },
266 auth_config: {
267 type: 'use_composio_managed_auth',
263 - tool_access_config: {
264 - tools_for_connected_account_creation: undefined,
265 - },
268 + credentials: undefined,
269 + name: undefined,
270 + tool_access_config: undefined,
271 },
272 });
273
@@ -302,7 +307,17 @@ describe('AuthConfigs', () => {
307 toolkit: {
308 slug: 'github',
309 },
305 - auth_config: options,
310 + auth_config: {
311 + type: 'use_custom_auth',
312 + name: 'Custom GitHub Auth',
313 + authScheme: 'OAUTH2',
314 + credentials: {
315 + client_id: 'test_client_id',
316 + client_secret: 'test_client_secret',
317 + },
318 + proxy_config: undefined,
319 + tool_access_config: undefined,
320 + },
321 });
322
323 expect(result).toEqual({
@@ -333,7 +348,14 @@ describe('AuthConfigs', () => {
348 toolkit: {
349 slug: 'github',
350 },
336 - auth_config: options,
351 + auth_config: {
352 + type: 'use_composio_managed_auth',
353 + credentials: {
354 + custom_field: 'value',
355 + },
356 + name: 'My GitHub Config',
357 + tool_access_config: undefined,
358 + },
359 });
360
361 expect(result).toEqual({
ts/packages/core/test/models/toolkits.test.ts
+2 -3
@@ -316,10 +316,9 @@ describe('Toolkits', () => {
316 },
317 auth_config: {
318 type: 'use_composio_managed_auth',
319 + credentials: undefined,
320 name: 'Test Toolkit Auth Config',
320 - tool_access_config: {
321 - tools_for_connected_account_creation: undefined,
322 - },
321 + tool_access_config: undefined,
322 },
323 });
324 expect(mockClient.connectedAccounts.create).toHaveBeenCalledWith({