@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());
```
@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: {github: stringgithub: "ac_your_github_config",slack: stringslack: "ac_your_slack_config", // gmail, linear, etc. use Composio managed auth },});
When users authenticate, they briefly see backend.composio.dev in their browser URL. Composio needs to receive the OAuth callback to capture and store the authentication tokens.
If you need to hide this URL (for enterprise compliance or complete white-labeling), you can proxy the redirect through your own domain:
Set your OAuth app's redirect URI to your domain:
https://yourdomain.com/api/composio-redirect
Create an endpoint that forwards the OAuth callback to Composio:
from fastapi import FastAPI, Requestfrom fastapi.responses import RedirectResponseapp = FastAPI()@app.get("/api/composio-redirect")def composio_redirect(request: Request): # Forward all OAuth parameters to Composio composio_url = "https://backend.composio.dev/api/v3/toolkits/auth/callback" return RedirectResponse(url=f"{composio_url}?{request.url.query}")
// pages/api/composio-redirect.ts (Next.js)import type { NextApiRequest,
The **`URLSearchParams`** interface defines utility methods to work with the query string of a URL.
[MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams)