Authentication
Authentication configurations (Auth Configs) define how users authenticate with third-party services in the Composio SDK. They specify the authentication method, required credentials, and permissions needed to connect to external platforms.Overview
TheAuthConfigs class manages authentication configurations that control how connected accounts authenticate with toolkits. Auth configs support various authentication schemes including OAuth2, API keys, and basic authentication.
Source: ts/packages/core/src/models/AuthConfigs.ts
Authentication Schemes
Composio supports multiple authentication schemes:OAUTH2- OAuth 2.0 authenticationOAUTH1- OAuth 1.0 authenticationAPI_KEY- API key-based authenticationBASIC- Basic username/password authenticationBEARER_TOKEN- Bearer token authenticationNO_AUTH- No authentication required
Listing Auth Configs
List All Auth Configs
Filter by Toolkit
Filter by Management Type
Pagination
Creating Auth Configs
Composio-Managed Authentication
Use Composio’s built-in OAuth apps (recommended for quick setup):Composio-managed authentication uses Composio’s pre-configured OAuth applications, making it easy to get started without registering your own OAuth apps.
Custom Authentication
Use your own credentials and OAuth apps:Advanced Configuration Options
Retrieving Auth Configs
Get detailed information about a specific auth config:Updating Auth Configs
Update Custom Auth Config
Update Default Auth Config
The update type (‘custom’ or ‘default’) determines which fields can be modified. Custom auth configs allow credential updates, while default configs allow scope modifications.
Managing Auth Config Status
Enable/Disable Auth Configs
Update Status Explicitly
When an auth config is disabled, it cannot be used to create new connected accounts or authenticate with third-party services. Existing connections may continue to work.
Deleting Auth Configs
Deleting an auth config is permanent and cannot be undone. It will prevent any connected accounts using this auth config from functioning.
Auth Config Properties
Every auth config object contains:id- Unique identifier for the auth configname- Human-readable nametoolkit- Associated toolkit informationauthScheme- Authentication scheme type (OAUTH2, API_KEY, etc.)isComposioManaged- Whether it uses Composio’s managed authenticationisEnabled- Current status (enabled/disabled)isEnabledForToolRouter- Whether it can be used with tool routerscopes- OAuth scopes (for OAuth-based configs)createdAt- Creation timestampupdatedAt- Last update timestamp
Complete Authentication Flow
Tool Access Control
Restrict which tools can be used with an auth config:Best Practices
Security
- Never hardcode credentials - use environment variables
- Rotate credentials regularly
- Use the minimum required OAuth scopes
- Enable auth configs only when needed
- Delete unused auth configs
Organization
- Use descriptive names for auth configs
- Create separate auth configs for different environments (dev, staging, prod)
- Document the purpose and scope of each auth config
Example: Environment-Based Auth Configs
Error Handling
Common errors when working with auth configs:ComposioAuthConfigNotFoundError- Auth config doesn’t existValidationError- Invalid parameters or credentials format- API errors (400) - Invalid configuration or missing required fields
- API errors (404) - Toolkit or auth config not found
Example Error Handling
Related Resources
- Connected Accounts - Use auth configs to create connections
- Toolkits - Services that require authentication
- Tools - Execute authenticated operations
- Providers - Integrate with AI frameworks