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 22, 23:15 UTC
Fix errors in toolkit authorize
haxzie committed
Jun 20, 2025 at 13:12 UTC
b906c8667ed7335a96fc245e7c19971752b94725
2 files changed
+17
-1
ts/examples/connected-accounts/src/magic-flow-demo.ts
+2
@@ -19,6 +19,8 @@ const connectionRequest = await composio.toolkits.authorize(userId, 'github');
19
// Redirect the user to continue to auth flow
20
const redirectUrl = connectionRequest.redirectUrl;
21
22
+console.log(`Redirect the user to ${redirectUrl}`);
23
+
24
// Wait for the user to connect the account / singin to GitHub
25
const connectedAccount = await connectionRequest.waitForConnection();
26
ts/packages/core/src/models/Toolkits.ts
+15
-1
@@ -19,7 +19,7 @@ import { ComposioAuthConfigNotFoundError } from '../errors/AuthConfigErrors';
19
import { ConnectedAccounts } from './ConnectedAccounts';
20
import { ConnectionRequest } from './ConnectionRequest';
21
import { telemetry } from '../telemetry/Telemetry';
22
-import { AuthSchemeEnum, AuthSchemeType } from '../types/authConfigs.types';
22
+import { AuthConfigListResponse, AuthSchemeEnum, AuthSchemeType } from '../types/authConfigs.types';
23
import logger from '../utils/logger';
24
/**
25
* Toolkits class
@@ -380,6 +380,20 @@ export class Toolkits {
380
const authConfig = await composioAuthConfig.list({
381
toolkit: toolkitSlug,
382
});
383
+ if (authConfig.items?.length === 0) {
384
+ throw new ComposioAuthConfigNotFoundError(
385
+ `No auth configs found for toolkit ${toolkitSlug}`,
386
+ {
387
+ meta: {
388
+ toolkitSlug,
389
+ },
390
+ possibleFixes: [
391
+ `Please Create an auth config for the toolkit ${toolkitSlug} via the dashboard`,
392
+ ],
393
+ }
394
+ );
395
+ }
396
+
397
// pick the first auth config
398
authConfigIdToUse = authConfig.items[0]?.id;
399