Skip to main content

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

The AuthConfigs 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 authentication
  • OAUTH1 - OAuth 1.0 authentication
  • API_KEY - API key-based authentication
  • BASIC - Basic username/password authentication
  • BEARER_TOKEN - Bearer token authentication
  • NO_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

toolAccessConfig.toolsForConnectedAccountCreation specifies which tools can be used during the connection creation process, while toolsAvailableForExecution restricts which tools can be executed using this auth config.

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 config
  • name - Human-readable name
  • toolkit - Associated toolkit information
  • authScheme - Authentication scheme type (OAUTH2, API_KEY, etc.)
  • isComposioManaged - Whether it uses Composio’s managed authentication
  • isEnabled - Current status (enabled/disabled)
  • isEnabledForToolRouter - Whether it can be used with tool router
  • scopes - OAuth scopes (for OAuth-based configs)
  • createdAt - Creation timestamp
  • updatedAt - 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 exist
  • ValidationError - 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