Identify who asked

Your bot runs as one client, but many people talk to it. Send who asked with each request, and optionally sign it, so Query checks shows the person behind every query.

This page assumes your bot is already connected; see the quickstart.


Pass the end user

Send an X-Vuon-End-User header with a stable id for the person who asked, such as slack:U0123ABC. Vuon records it on every query the BigQuery server runs and shows it as end user on Query checks. The Vuon server accepts the header but records nothing for it, so send it to both servers.

  • Use a stable id, not a display name, and nothing secret: admins see it on Query checks.
  • Vuon trims the value and clips it to 200 characters. A blank value is ignored.
  • The header wins over a vuon_user job label, so the model can't change who a query was for.

Verify the end user

Anyone holding the key can put any name in X-Vuon-End-User, so Query checks shows it as unverified. To have Vuon show it as verified, your bot also sends a short-lived token that names the person, signed with a secret from the client's page.

A verified end user changes three things:

  • Query checks shows them as verified, with the signing key's id, such as slack:T01:U0123ABC · verified (vek_3kQ…). A token that fails is recorded with the reason, such as token rejected: expired.
  • The token's subject becomes the end user, over the header and any vuon_user label.
  • They get their own viewer pod for charts and transforms, up to 3 per client by default. Their first chart runs on the bot's shared pod while theirs starts. Once all of a client's pods are in use, others share the bot's pod.

Access doesn't change, and a missing or failing token never fails a request: Vuon falls back to the header, unverified.

The signature means most when the service that signs tokens isn't the one holding the API key. For example, your Slack event handler, which has already checked Slack's signature, signs the token and passes it to the worker that runs the model.

Create a signing key

  1. On the client's page, find End-user verification and click Create signing key.
  2. Copy the key id (vek_…) and the signing secret (vuon_eus_…). The secret is shown once.
  3. Copy the Issuer and Audience shown in the same section.

Give them to the service that signs tokens as secrets:

.env

VUON_CLIENT_ID=...               # the Issuer
VUON_END_USER_KEY_ID=vek_...
VUON_END_USER_SECRET=vuon_eus_...

Send a token with each request

Send the token as X-Vuon-End-User-Token on every request, next to X-Vuon-End-User. It is a JWT signed with HS256, using the secret's text as the key:

PartValue
alg headerHS256
typ headervuon-end-user+jwt
kid headerThe key id
issThe client's id, shown as Issuer
audYour workspace URL, shown as Audience. Always this URL, even if you reach Vuon through another hostname.
subA stable id for the person, such as slack:T01:U0123ABC. At most 200 characters, with no leading or trailing spaces.
iatWhen you signed it
expAt most 5 minutes after iat

Vuon allows 30 seconds of clock difference. A conversation can outlast five minutes, so send a valid token on every request and refresh it before it expires rather than keeping one token for the whole conversation.

With the Vercel AI SDK, pass a fetch that adds a fresh token to each request. This uses jose (npm install jose), checked against 6.2:

Sign the end user

import { SignJWT } from 'jose';

const secret = new TextEncoder().encode(process.env.VUON_END_USER_SECRET);

function endUserToken(endUser: string) {
  return new SignJWT({})
    .setProtectedHeader({
      alg: 'HS256',
      typ: 'vuon-end-user+jwt',
      kid: process.env.VUON_END_USER_KEY_ID,
    })
    .setIssuer(process.env.VUON_CLIENT_ID!)
    .setAudience(process.env.VUON_URL!)
    .setSubject(endUser)
    .setIssuedAt()
    .setExpirationTime('2m')
    .sign(secret);
}

export function signedFetch(endUser: string) {
  return async (input: RequestInfo | URL, init?: RequestInit) => {
    const headers = new Headers(init?.headers);
    headers.set('X-Vuon-End-User-Token', await endUserToken(endUser));
    return fetch(input, { ...init, headers });
  };
}

In the quickstart's connectVuon (vuon.ts), add fetch: signedFetch(endUser) to each transport. The MCP TypeScript SDK takes the same fetch option on StreamableHTTPClientTransport. Keep sending X-Vuon-End-User, so if a token ever fails, Query checks still shows who asked, as unverified, with the reason.

For LangGraph with @langchain/mcp-adapters 2.0.2, add a top-level beforeToolCall callback to the quickstart's MCPAdapter configuration. Reuse endUserToken above, and capture the end user from the trusted request handler, not the model. The adapter applies the returned headers to that tool call:

Verify each LangGraph tool call

const endUser = `slack:${slackUserId}`;
let token: { value: Promise<string>; refreshAt: number } | undefined;
function currentToken() {
  if (!token || Date.now() >= token.refreshAt) {
    token = {
      value: endUserToken(endUser).catch((error) => {
        token = undefined;
        throw error;
      }),
      refreshAt: Date.now() + 60_000,
    };
  }
  return token.value;
}
const adapter = new MCPAdapter({
  servers: {
    vuon: { url: base, headers },
    'vuon-bigquery': { url: `${base}/bigquery`, headers },
  },
  beforeToolCall: async () => ({
    headers: {
      'X-Vuon-End-User-Token': await currentToken(),
    },
  }),
});

Keep the conversation's authorization, session, and plain end-user headers on both servers as in the quickstart. Discovery requests need no signed end user; the callback attaches a valid token to tool calls, including the queries recorded on Query checks. Keep this cache local to one conversation and end user. It reuses the two-minute token for up to one minute, leaving time for the request to reach Vuon. The adapter caches a separate MCP connection for each distinct header set, so signing a different token on every call would add handshakes and connections. adapter.close() closes all of them; keep the quickstart's finally cleanup. The callback's header override is defined by the adapter's published hook types.

Clients configured with fixed headers, such as the Claude Agent SDK example in the quickstart and the Pi and OpenCode CLIs, can't sign a token per request. A token set when the process starts stops verifying after five minutes.

Rotate or revoke

Rotate key makes a new secret and keeps the old one working for an overlap you choose: 1 hour, 24 hours (the default), or 7 days. Deploy the new secret, wait for the old key's Last verified a token to stop changing, and the old key retires by itself.

Revoke stops a key at once, for a leaked secret. Your bot keeps working, and its end users show as unverified until it signs with another key.


Troubleshooting

The end user is empty on Query checks

The header isn't reaching the BigQuery server, or it is blank. Check that the header name is exactly X-Vuon-End-User, and that your code sends it to /api/mcp/bigquery, not only /api/mcp. With a long-lived client, check that the request ran inside the context that sets the user.

Everyone shows the same end user

A long-lived client is reusing one person's headers. Open a client per conversation, as in the quickstart, or make the per-request hook read the current user.

The end user shows as unverified

No X-Vuon-End-User-Token reached Vuon. Check the header name, and that your code sets it on every request.

"Token rejected"

Query checks names the reason:

  • expired or not valid yet: the signing machine's clock is off by more than 30 seconds, or a token was reused past its lifetime. Check the signing machine's clock and refresh the token before it expires. The LangGraph example above refreshes its two-minute token after at most one minute.
  • lifetime over 5 minutes: exp is more than five minutes after iat.
  • wrong audience: aud must be exactly the Audience on the client's page.
  • wrong issuer: iss must be this client's id, the Issuer on its page. Another client's key never verifies this client's tokens.
  • unknown signing key or signing key revoked or retired: the kid isn't one of this client's active keys. After a rotation, deploy the new key before the overlap ends.
  • bad signature: the secret doesn't match the kid.
  • wrong typ header or algorithm not allowed: set typ to vuon-end-user+jwt and alg to HS256.

FAQ

Can Vuon limit what each Slack user can see?

Not yet. The end user is attribution only, verified or not: everyone behind the bot gets the client's access. Limit the bot with the client's tools, enforcement mode, and caps, and control who can talk to the bot in Slack.

Can I send the end user in a query parameter?

No. Send the X-Vuon-End-User header.


Was this page helpful?