Authentication

Markdown

Composio simplifies authentication with Connect Links: hosted pages where users securely connect their accounts.

In-chat authentication

By default, when a tool requires authentication, the agent prompts the user with a Connect Link. The user authenticates and confirms in chat. The agent handles OAuth flows, token refresh, and credential management automatically.

Here's what this looks like in a conversation:

You: Summarize my emails from today

Agent: I need you to connect your Gmail account first. Please click here to authorize: https://connect.composio.dev/link/ln_abc123

You: Done

Agent: Here's a summary of your emails from today...

This flow works well for chat applications where users interact directly with the agent.

In-chat authentication

Let the agent handle authentication prompts automatically during conversation

Manual authentication

For apps that manage auth outside of chat, use session.authorize() to generate Connect Links programmatically. This is useful when you want users to connect accounts during onboarding, or when building a custom connections page.

Manual authentication

Control when and how users connect their accounts

How Composio manages authentication

Behind the scenes, Composio uses auth configs to manage authentication.

Composio handles this automatically:

  1. When a toolkit needs authentication, we create an auth config using Composio managed credentials
  2. The auth config is reused for all users authenticating with that toolkit
  3. Connected accounts are created and linked to your users

Most toolkits work out of the box with Composio managed OAuth. For API key-based toolkits, users enter their keys directly via Connect Link.

You only need to create a custom auth config when:

  • You want to use your own OAuth app credentials for white-labeling
  • You need specific OAuth scopes beyond the defaults
  • The toolkit doesn't have Composio managed auth
  • You have existing auth configs with connected accounts you want to use

To bring your own OAuth apps or customize scopes, see custom auth configs.