Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 23, 03:00 UTC
Update examples for authconfigs and connected accounts
haxzie committed
May 15, 2025 at 22:40 UTC
fd4adfd3e3b713e069d571f7ed50b294900bfab5
2 files changed
+21
-8
examples/connected-accounts/src/index.ts
+15
-8
@@ -1,4 +1,4 @@
1
-import { Composio } from '@composio/core';
1
+import { AuthConfigTypes, AuthSchemeTypes, Composio } from '@composio/core';
2
import { OpenAI } from 'openai';
3
4
const openai = new OpenAI({
@@ -15,14 +15,21 @@ const tools = await composio.tools.get('user123', {
15
tools: ['HACKERNEWS_GET_USER'],
16
});
17
18
-const ConnectionRequest = await composio.createConnectedAccount('default', 'ac_rjfaMZTL4RzX', {});
19
-
20
-console.log(ConnectionRequest);
18
+/**
19
+ * Create a new auth config
20
+ */
21
+const authConfig = await composio.createAuthConfig('my-toolkit', {
22
+ type: AuthConfigTypes.CUSTOM,
23
+ authScheme: AuthSchemeTypes.API_KEY,
24
+ credentials: {
25
+ apiKey: '1234567890',
26
+ },
27
+});
28
29
+/**
30
+ * Create a new connected account
31
+ */
32
+const ConnectionRequest = await composio.createConnectedAccount('default', authConfig.id);
33
const connectedAccount = await ConnectionRequest.waitForConnection();
34
35
console.log(connectedAccount);
25
-
26
-// const connectedAccount = await composio.connectedAccounts.get('ca_yAflyFVJs0p4');
27
-
28
-// console.log(connectedAccount);
packages/core/src/index.ts
+6
@@ -12,6 +12,12 @@ export { jsonSchemaToModel } from './utils/jsonSchema';
12
export { Tool, ToolListParams, ToolListParamsSchema, ToolExecuteParams } from './types/tool.types';
13
export { Toolset, ExecuteToolFn, ExecuteToolFnOptions } from './types/toolset.types';
14
export { ExecuteMetadata } from './types/customTool.types';
15
+export {
16
+ AuthConfigTypes,
17
+ AuthSchemeTypes,
18
+ AuthConfigType,
19
+ AuthSchemeType,
20
+} from './types/authConfigs.types';
21
// Type exports
22
export type {
23
ExecuteToolModifiers,