Custom Auth Parameters
Guide to injecting custom credentials in headers or parameters for a toolkit
In case Composio is not being used for managing the auth but only for the tools. It is possible to use the beforeExecute
hook to inject custom auth headers or parameters for a toolkit.
Setup and Initialization
First, initialize the Composio SDK with your API key:
Creating the Auth Modifier Function
Define a function that modifies authentication parameters for specific toolkits. This function checks the toolkit name and adds custom authentication headers when needed.
Executing Tools with Custom Auth
Execute the tool using the custom authentication modifier. The beforeExecute
hook allows you to modify parameters before the tool runs.
Following is an example of how to execute a tool with a custom authentication modifier for Completion Providers.
For Agentic Providers, read about Before Execution Modifiers.