The driver asked the chat: “What’s my balance?”
The chat answered with the right number.
It did not ask for a password. It did not read anyone else’s balance. And — the part that matters for anyone wiring an LLM to a backend — the language model was never told who the driver was in a way it could get wrong or abuse.
This is the story of the smallest piece of that system: how you hand an AI chat just enough identity to answer a personal question, without handing it the keys.
The two obvious ways — and why both fail
A chatbot that answers from a static FAQ is fine for “How much is a room?” It falls apart the moment the question becomes “How much is my …?” — my balance, my last trips, my order.
There are two tempting ways to fix that, and both are traps.
The first is to put the user’s data into the prompt. Load the knowledge base with everyone’s balance and let the model pick the right row. This leaks. Prompts cross sessions, get logged, get cached, and a model asked the wrong way will happily recite the neighbor’s balance to the wrong person.
The second is to ask the model to figure out who is asking. “Extract the user ID from the conversation.” This is spoofable by design. Anyone who can reach the endpoint can type “I’m driver 1234” and see where it gets them.
The model should not decide identity. Identity is a fact the application already knows, and the chat should only ever receive a proof of it that it cannot modify.
The answer: a signed token the chat cannot read
The host application — the taxi app, the booking system, whatever already owns the user — authenticates the user the normal way (a cookie, a session). Then it mints a short-lived token and hands it to the chat.
The token is deliberately boring:
driver.7f3a.9c1e2d… // subject . expiry . HMAC signature
- A subject that identifies the user — or, better, a single booking.
- An expiry measured in minutes, not days.
- A signature the host can verify, with a key the chat is never given.
The chat treats the token as an opaque string. It forwards it. It never inspects it, never stores it meaningfully, never signs one of its own. It is a blind messenger, and that blindness is the security property.
Keeping the token out of the model’s hands
Forwarding a token is only half the answer. The other half is making sure the language model cannot touch it.
When the chat needs live data, it uses function calling: the model picks a tool (“driver_balance”) and fills in arguments. Those arguments are exactly where a token would leak — the model could “fill in” a different user’s ID, or be tricked into revealing the one it was given.
So we remove the token from the model’s view entirely. In the strategy config, the token parameter is marked as a contextParams value:
{
"strategyId": "driver_balance",
"endpoint": "https://host.example/driver/chat/balance",
"method": "GET",
"params": { "token": "{driverToken}" },
"contextParams": ["driverToken"]
}
Two things follow from that single line:
- The token is excluded from the function-calling schema. The model never sees
driverTokenas something to ask for or fill in. - When the call is actually made, the chat overwrites that argument with the trusted value from the host. If the model somehow produced its own “token,” it loses. The trusted value always wins.
The model picks which tool and what question. It never gets to supply who.
What the host returns — and doesn’t
The host endpoint is the only place that verifies the signature — in constant time, so the signature can’t be fingerprinted by timing — and decides what to send back.
It does not return “the driver object.” It returns the balance. For trip history, it returns the last ten trips, stripped of pickup and drop-off addresses and per-trip ratings: enough to answer the question, nothing that isn’t needed.
That last habit — return only what the question needs — is easy to skip and quietly expensive to omit. It is the difference between a feature and a data leak with a chat bubble on it.
The flow, end to end
- The driver signs in to the taxi app. The chat is not involved.
- The taxi app mints a short-lived signed token.
- The app mounts the chat and passes the token in a
toolContextpayload. - The widget forwards the payload unchanged — no widget code to change.
- The chat receives the token, but excludes it from what the model can see (
contextParams). - The model picks the “balance” tool; the chat substitutes the real token in the background.
- The host verifies the token and returns only the driver’s own data.
- The answer goes into the prompt, and the model replies — grounded in live data, not a guess.
What this is not
It is not single sign-on. It is not a general-purpose user system. The chat still knows nothing about the customer until the host pushes or serves that data through an API.
It is a narrow, auditable pattern for one job: let a conversation ask about this user’s data without becoming the system that owns it.
The assistant may be helpful. It does not get promoted to database.
FodyChat is the embeddable chat behind this pattern. The same signed-token flow powers the driver balance and trip history in the Rent Taxi cabin, and is documented for developers in the tools-mode API guide.