docs/content/docs/authentication.mdx
Composio simplifies authentication with Connect Links: hosted pages where users securely connect their accounts. There are two approaches. Choose based on where in your app users should authenticate.
<Video src="/images/connect-link-auth-flow-recording.mp4" autoPlay />session.authorize() during onboarding or from a settings page.Not sure? Start with in-chat. You can add manual auth later.
By default, when a tool requires authentication, the agent prompts the user with a Connect Link. The user authenticates and confirms in chat. No setup needed. Just create a session and the agent handles OAuth flows, token refresh, and credential management automatically.
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...
<Card icon={<MessageCircle />} title="In-chat authentication guide" href="/docs/authenticating-users/in-chat-authentication"> Configuration, callback URLs, and full examples </Card>
Use session.authorize() to generate Connect Links programmatically when you want to control when and where users authenticate. Common use cases:
<Card icon={<ShieldCheck />} title="Manual authentication guide" href="/docs/authenticating-users/manually-authenticating">
session.authorize() API, callback URLs, and connection status checks
</Card>
Behind the scenes, Composio uses auth configs to manage authentication.
An auth config is a blueprint that defines how authentication works for a toolkit across all your users. It specifies:
Composio creates one auth config per toolkit, and it applies to every user who connects that toolkit. When a user authenticates, Composio creates a connected account that stores their credentials (OAuth tokens or API keys) and links them to your user ID. When you need to use your own OAuth credentials or customize scopes, you can create custom auth configs.
graph LR
AC["Auth Config
<b>ac_gmail_oauth2</b>"]
subgraph user_1
CA1["Work Gmail · <b>ca_1a2b3c</b>"]
CA2["Personal Gmail · <b>ca_4d5e6f</b>"]
end
subgraph user_2
CA3["Gmail · <b>ca_7g8h9i</b>"]
end
AC --> CA1
AC --> CA2
AC --> CA3
Composio handles this automatically:
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:
To bring your own OAuth apps or customize scopes, see custom auth configs.