Using custom auth configs

Set up auth configs for toolkits without Composio managed authentication

Some toolkits don't have Composio managed authentication and require you to provide your own credentials. When Tool Router tries to use these toolkits, it will throw an error asking you to create an auth config.

Check if a toolkit needs custom credentials

In the Composio platform, go to "All Toolkits" and select the toolkit. If it shows no Composio managed auth schemes, you'll need to create an auth config.

Create an auth config

  1. Go to Authentication management in the dashboard
  2. Click Create Auth Config
  3. Select the toolkit
  4. Choose the auth scheme (OAuth2, API Key, etc.)
  5. Enter your credentials (client ID, client secret, API key, etc.)
  6. Click Create

Copy the auth config ID (e.g., ac_1234abcd).

For detailed instructions on getting credentials for specific toolkits, see Custom auth configs.

Use in Tool Router

Pass your auth config ID when creating a session:

session = composio.create(
    user_id="user_123",
    auth_configs={
        "posthog": "ac_your_posthog_config"
    }
)
const const session: ToolRouterSession<unknown, unknown, OpenAIProvider>session = await const composio: Composio<OpenAIProvider>composio.Composio<OpenAIProvider>.create: (userId: string, routerConfig?: ToolRouterCreateSessionConfig) => Promise<ToolRouterSession<unknown, unknown, OpenAIProvider>>
Creates a new tool router session for a user.
@paramuserId The user id to create the session for@paramconfig The config for the tool router session@returnsThe tool router session@example```typescript import { Composio } from '@composio/core'; const composio = new Composio(); const userId = 'user_123'; const session = await composio.create(userId, { manageConnections: true, }); console.log(session.sessionId); console.log(session.url); console.log(session.tools()); ```
create
("user_123", {
authConfigs?: Record<string, string> | undefinedauthConfigs: { posthog: stringposthog: "ac_your_posthog_config", }, });

Tool Router will now use your auth config when users connect to this toolkit.