Authenticating Tools
Different apps (like Slack, Notion, Shopify) have their own authentication flows that users must complete to grant access to their accounts. Agents need authenticated access to these tools to perform actions on behalf of users.
Creating an auth config
Each toolkit comes with it’s own auth config. This configuration is used to authenticate the users to the tools.
The first step is to create an auth config for any toolkit that you want to use.
Auth configs are reusable
The appropriate developer credentials and app level configurations like scopes, API endpoints, etc. are scoped to an auth config.
Once created, it’s reusable across multiple users.
Dashboard
CLI
The dashboard offers a guided process for all app types.
Select App
Navigate to the Apps page and choose the app you want to integrate (for example, Google Sheets).

Configure Auth Config Settings
Select between the supported auth schemes of OAuth2, API Key, Bearer Token, Basic Auth, depending on the toolkit. Switch between the auth schemes and configure the scopes, developer credentials, etc here.
Composio Managed Auth
You may also choose to use Composio’s managed auth for certain toolkits or use your own auth credentials. It is recommended to use specify your own credentials for production workloads and ability to control scopes, etc.

Connecting to an OAuth toolkit
Here’s how to authenticate a toolkit for a given user using the OAuth flow.
Connecting to an API Key toolkit
For API key based toolkits, you can either request the user to provide the API key or provide your own!
Creating the connection
If you know the required authentication fields for your toolkit (like apiKey
for most API-based services), you can directly create the connection:
Fetching the field name
For more complex cases where you want to dynamically discover the exact field names and handle different auth schemes programmatically, you can fetch the auth field details first.
Here’s how to fetch the auth field names for a toolkit:
It might be useful to read all the optional and required auth config fields for a toolkit and optionally prompt the user for the values.
Putting it all together
Below is a sample script that request the user or uses environment variables to read all the required fields for a token based toolkit.
Redirecting users
To control where the users are redirected after they have authenticated, you can use the redirectUrl
parameter in the initiate
method.
In this case, the user will be redirected to https://www.yourapp.com/callback
after they have authenticated.