Passing a user specific token
# support
a
Hi, I'm embedding a Vapi assistant widget in my UI and I'm going to use both mods - chat and voice (user is able to switch them via the UI toggle after which I mount the widget with the corresponding mode). In both mods the assistant should use a user-specific Bearer token when calling an API/MCP tool. Providing a static long-living token directly inside dashboard for the tools is not my use case as the tool suppose to return a user-specific data. I tried to use my custom {{userToken}} variable and assistant-override property of the widget to pass this token from UI to Vapi The assistant doesn't catch it and the request to the API tool is not working. I'm providing an override property as it's suggested in documentation. And it seems to work according to the network tab of the browser. The payload to the https://api.vapi.ai/chat/web is: { "assistantId": "20c771c...", "assistantOverrides": { "variableValues": { "userToken": "eyJhb..." } }, "input": [...], "stream": true } Inside the Dashboard, in the API Request tool I set the Bearer {{userToken}} value for an Authorization request header and added the following system prompt to the Assistant itself: "You must use the {{userToken}} variable as a Bearer token value for Authorization request header when using backend tools and APIs." However when I'm asking an assistant to show me the data it firstly asks to wait and later reports an "issue retrieving the data". When I'm providing a static access token directly in the dashboard ("Bearer eyh..") the tool works perfectly and the data is returned, so the issue is caused by the variable. In the logs of the dashboard I see that the assistant invokes the correct tool but there are no response displayed. What might be an issue? Perhaps I'm doing something wrong? https://cdn.discordapp.com/attachments/1420432940353065132/1420432940558712842/image.png?ex=68d560c3&is=68d40f43&hm=69be142f75327fcd2efca4c38c796248710e5a83769dad51cac2fab9724ccf84& https://cdn.discordapp.com/attachments/1420432940353065132/1420432941145919508/image.png?ex=68d560c3&is=68d40f43&hm=f0db859247a5636f50ba1650d6b223e8d80129c1ed8b375e422575241fe22cee&
v
I see the issue: your override is being sent from the UI, but the {{userToken}} may not be resolving inside the tool. In the dashboard, the variable must be explicitly declared under “Variables,” not just referenced in the header. If it’s missing, the Authorization header goes out empty and causes the failed request. I can help you review the tool config to ensure the variable is mapped correctly. Did you already add userToken under Variables in the API Request tool? @Alexander
a
Hi,@Vercel Sorry, I don't see any "Variables" section in the tool config or in the assistant config in the Dashboard, so I can not add the variable there. The only place where I see the variable is when I'm opening the "Test" window of the tool. Could you please provide me a screenshot where it suppose to be? I appreciate any help. Happy to jump on a quick call. https://cdn.discordapp.com/attachments/1420432940353065132/1420676055370436608/image.png?ex=68d6432e&is=68d4f1ae&hm=178c3696f61e8f608cc62e27d08feea01f8c6fe61975fa320be8fddbb802612e& https://cdn.discordapp.com/attachments/1420432940353065132/1420676055806509077/image.png?ex=68d6432e&is=68d4f1ae&hm=d845c22cb284ee31b0811cac4f5f0e0bd59cee6a369abae84df4f0e4d497332a&
v
Thanks for the screenshot, you’ve added Bearer {{userToken}} in the header correctly. The issue is the dashboard doesn’t recognize it as a live variable unless it’s bound at runtime. Your override is being sent from the UI, but the tool isn’t applying it during the request. I can walk you through the setup so the token gets passed properly. Let’s jump on a quick call , when’s a good time for you? Let's discuss more privately @Alexander
a
Thanks @Vercel, I've wrote you in DM
v
I replied to you @Alexander check
a
@Vapi Are there any other ideas what might be an issue?
c
Any custom variables and default dynamic variables that are being configured outside of a call will not show and this is intended behavior
3 Views