How to pass variables between tools for OAuth/JWT ...
# support
v
I'm building a financial commitment system that requires a two-step authentication flow: Tool 1: Get OAuth token (POST to /oauth/token) → returns access_token Tool 2: Use token to call business API (POST to /api/resource) → requires Authorization: Bearer {token} My current setup: Tool 1 (get_auth_token): Works correctly Returns valid access_token Configured as Function with API Request Tool 2 (call_business_api): Header configured as: Authorization: Bearer {{get_auth_token.access_token}} Fails with "Invalid token" because header arrives empty LLM doesn't automatically pass token from Tool 1 What I've tried: Automatic variables: {{tool_name.variable}} in headers - Doesn't work Explicit parameter: Added auth_token as parameter to Tool 2, configured system prompt for LLM to pass token - Doesn't work consistently Workflows: Tried workflows with variables {{access_token}} between nodes - Workflows have bugs (doesn't start conversation) My question: What's the correct way to pass a tool's result as a parameter to another tool in Vapi? This is a very common pattern in enterprise applications where you need to: Get authentication token Use it immediately in business operations Maintain separation of concerns between tools Technical info: Platform: Voice calls via assistant Token type: JWT with short expiration (fixed tokens not viable) Endpoints: Corporate REST APIs with OAuth 2.0 Use case: Financial system requiring authentication for regulatory compliance Has anyone successfully implemented this type of flow? Is there a specific configuration I'm missing? Any guidance would be greatly appreciated. Thanks in advance.
v
Thanks for the detailed context! To help pinpoint the issue, could you clarify whether your tools are configured as custom server endpoints (with a
server.url
in the tool definition) or as built-in Vapi functions? This will help determine if variable passing (like
{{get_auth_token.access_token}}
) should work natively or if a custom orchestration is needed. Sources: - [Custom LLM Tool Calling Integration](https://docs.vapi.ai/customization/tool-calling-integration) - [Custom Tools](https://docs.vapi.ai/tools/custom-tools)
v
Thanks for the clarification! Here are the specific details about my setup: Current Configuration: - **Tool 1**: Built-in API Request → POST /oauth/token (form data) → captures
access_token
- **Tool 2**: Built-in API Request → POST /resource with
Authorization: Bearer {{get_auth_token.access_token}}
**Issue**: The variable
{{get_auth_token.access_token}}
doesn't resolve - header arrives empty. **Also Tried**: Workflows with 2 API Request nodes and
{{access_token}}
variable passing, but workflow doesn't start conversation (assistant doesn't speak, call ends immediately). **Questions**: 1. Should
{{tool_name.variable}}
work between built-in API Request functions? 2. Is there a way to implement OAuth → Business API flow using only Vapi's built-in functions? 3. Do workflows support variable passing between API nodes, or are the audio issues a known limitation? I'm trying to keep everything within Vapi's native functionality without external servers. Is there a configuration I'm missing for this OAuth pattern? Thanks!
t
@Valentina I can help you in order to fix it. If you want, I am open right now.
v
@Toketo1 Thanks for offering to help! I really appreciate it. Would it be possible to get some written guidance here in the thread instead? I'd prefer to keep the discussion public so others with similar issues can benefit from the solution. Specifically, I'm looking for: 1. Whether
{{tool_name.variable}}
should work between built-in API Request functions 2. If there's a correct way to configure this OAuth flow within Vapi's native tools 3. Any known issues or limitations with workflows for this use case If you have documentation links or configuration examples that would be perfect. I understand if some complex issues require more detailed discussion, but any written pointers would be greatly helpful. Thanks again for the support!
t
It depends i would do it outside of VAPI, It depends on your backend configuration. Are you self-coding the financial commitment system. I got the same problem it depends whether or not you are integrating a system with psd2 license or not it is a complex thing to debug. For security reasons, I would do it outside of vapi.
My team and I, are open to help you. website: smartversegroup.com. We are doing financial integration within our country of operation.
@Valentina
I have to see the setup, in order to help.
2 Views