Manually authenticating users
Manual authentication lets you connect users to toolkits outside of the chat flow. Use this when you want to:
- Pre-authenticate users before they start chatting
- Build a custom connections UI in your app
Authorize a toolkit
Use session.authorize() to generate a Connect Link URL, redirect the user, and wait for them to complete:
Redirect the user to the redirect URL. After they authenticate, they’ll return to your callback URL. The connection request polls until the user completes authentication (default timeout: 60 seconds).
If the user closes the Connect Link without completing auth, the connection remains in INITIATED status until it expires.
Check connection status
Use session.toolkits() to see all toolkits in the session and their connection status:
Disabling in-chat auth
By default, Tool Router includes the COMPOSIO_MANAGE_CONNECTIONS meta-tool that prompts users to authenticate during chat. To disable this and handle auth entirely in your UI:
Putting it together
A common pattern is to verify all required connections before starting the agent: