https://retellai.com/?utm_source=discord&utm_medium=seo logo
Do Retell custom functions or code tools support O...
# ❓・ai-evy-support
a
@AI Evy Do Retell custom functions or code tools support OAuth 2.0 Client Credentials authentication natively? Specifically, can a Retell tool securely store a Cognito client_id and client_secret, request an access_token from an AWS Cognito token endpoint before each tool call or when expired, and automatically send Authorization: Bearer to an API Gateway JWT-protected endpoint? I do not want to manually paste short-lived bearer tokens into tool headers, and I do not want to hardcode the Cognito client secret inside JavaScript code tools unless Retell has encrypted secret/environment-variable storage for tools. If native OAuth client credentials is not supported, what is Retell’s recommended production pattern for calling APIs that require short-lived OAuth bearer tokens?
a
Thanks for tagging me @Alex. I'll look through relevant sources and get back to you shortly.
ger, environment variables, etc.) . [(2) ]()
### Answer Retell custom functions do not natively support OAuth 2.0 Client Credentials authentication with automatic token refresh and secure credential storage. [(1) ]() Custom functions allow you to set request headers, but these can only be static values or dynamic variables—there's no built-in OAuth flow, token management, or encrypted secret storage within the Retell dashboard. Retell's recommended production pattern is to use a wrapper API that you host and control. [(1) ]() [(2) ]() Here's how this works: 1. Host a wrapper API on your own infrastructure (serverless functions, cloud platforms, etc.) [(2) ]() 2. **Handle OAuth authentication in your wrapper**: Your wrapper API securely stores the Cognito
client_id
and
client_secret
, requests access tokens from the Cognito token endpoint, manages token expiration/refresh, and calls your protected API Gateway endpoint with the
Authorization: Bearer <access_token>
header 3. **Configure Retell to call your wrapper**: Add your wrapper API URL as a custom function endpoint in the Retell dashboard [(1) ]() [(2) ]() 4. **Verify requests from Retell**: Use the
X-Retell-Signature
header to verify that incoming requests to your wrapper are actually from Retell [(1) ]() This approach keeps your OAuth credentials and token logic completely outside Retell, in an environment you control with proper secret management (AWS Secrets Mana
​ To learn more, see the sources I considered: [[1] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[2] Zapier, ServiceTitan and Retell](https://discord.com/channels/1186424376300679209/1305569900680708116) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.