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 docs for connected accounts
haxzie committed
Jun 16, 2025 at 19:09 UTC
dbd5a16cb99ffbe81d219bbfe5cd8ce5ec54c840
1 file changed
+38
ts/docs/api/connected-accounts.md
+38
@@ -391,3 +391,41 @@ Each helper function returns a properly typed `ConnectionData` object that ensur
391
392
- `INITIALIZING` for OAuth2, OAuth1, and ComposioLink schemes
393
- `ACTIVE` for all other schemes
394
+
395
+## Multiple Connected Accounts
396
+
397
+By default, Composio prevents users from having multiple connected accounts for the same auth configuration. This is to prevent potential conflicts and ensure consistent behavior. However, you can override this behavior if your use case requires multiple connections.
398
+
399
+### Default Behavior
400
+
401
+When attempting to create a new connected account, if the user already has an active connection for that auth configuration, Composio will throw a `ComposioMultipleConnectedAccountsError`.
402
+
403
+```typescript
404
+// This will throw if the user already has a connection
405
+try {
406
+ await composio.connectedAccounts.initiate('user_123', 'auth_config_123');
407
+} catch (error) {
408
+ if (error instanceof ComposioMultipleConnectedAccountsError) {
409
+ console.log('User already has a connected account for this auth config');
410
+ }
411
+}
412
+```
413
+
414
+### Allowing Multiple Connections
415
+
416
+If your application needs to support multiple connections for the same auth configuration (e.g., connecting to multiple GitHub accounts), you can enable this by passing the `allowMultiple` option:
417
+
418
+```typescript
419
+// This will allow creating multiple connections
420
+const connection = await composio.connectedAccounts.initiate('user_123', 'auth_config_123', {
421
+ allowMultiple: true,
422
+});
423
+```
424
+
425
+When `allowMultiple` is enabled:
426
+
427
+- Multiple active connections are allowed for the same user and auth configuration
428
+- A warning will be logged to help track this behavior
429
+- You'll need to manage these multiple connections appropriately in your application logic
430
+
431
+> **Note:** Be cautious when enabling multiple connections as it may require additional handling in your application to manage which connection to use for specific operations.