ComposioComposio 0.21 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
8 small wins to finish your pathNext lesson

Users, auth configs and connected accounts

Every tool call runs as one of your users. A connected account is that user's authorised connection to an app; an auth config says how connections to that app are made.

TermWhat it isExample
user idYour identifier for a user; Composio stores connections under it"cust_7f3a", your database id
toolkitAn app and its toolsgithub, gmail
auth configHow users connect to a toolkit: Composio's managed OAuth app or your ownac_...
connected accountOne user's live, authorised connectionca_...
Examplewith a key
session = composio.create(user_id="cust_7f3a", toolkits=["github"])
request = session.authorize("github", callback_url="https://your-app.example/connected")
print(request.redirect_url)   # send the user here to sign in to GitHub
request.wait_for_connection()
Example
import inspect

from composio.core.models.connected_accounts import ConnectedAccounts
from composio.core.models.tool_router_session import ToolRouterSession

print(list(inspect.signature(ToolRouterSession.authorize).parameters)[1:])
print(list(inspect.signature(ConnectedAccounts.link).parameters)[1:])

Two ways to start a connection, from the installed SDK. session.authorize(toolkit) creates a sign-in link inside a session. composio.connected_accounts.link(user_id, auth_config_id) does it for a specific auth config, outside a session. Both return a ConnectionRequest whose redirect_url the user opens; Composio completes OAuth and stores the tokens.

User ids are a security boundary
Connections are stored under the id you pass, so use a stable database id, not an email that can change, and never one shared id such as default for everyone, which would let every user act through the same connections.
Try it yourself
  • Print the parameters of ConnectedAccounts.initiate.
  • Find ConnectionRequest in the SDK and list its fields.
  • Write down which user id your own app would pass, and where it comes from.

You understood something today that you didn't yesterday.