Repository navigation
Authenticated Embed
By default an embedded (iframe) chat is anonymous: the assistant does not know who the visitor is. With authenticated embed the assistant knows exactly who is talking to it, so a tool behind it — a CRM, an ERP, a ticketing system — can return only that person's data.
This page is the integration guide for the team that owns the host site: how to choose a mode and what your backend has to do. For the console reference — every field of the User identity verification (embed) card — see Administrator-Guide → Embedded Chat — Authenticated Identity.
Without a verified identity the assistant can answer general questions, but it cannot answer "which tickets do I have open?" — because it does not know who "I" is, and because trusting whatever the page declares would let anyone read anyone else's data by editing a parameter.
The design is deliberately identity-provider agnostic: XRCopilot never talks to your login system. Whatever you use — passwords, Google, Microsoft Entra ID, SPID, something bespoke — stays exactly as it is. After your user signs in, your backend asserts who they are, XRCopilot verifies that assertion server-side, and only then does the chat session belong to that person.
Verification is fail-closed: if a token or session is present but invalid or expired, the chat is blocked rather than quietly downgraded to anonymous. There is no "partly verified" state.
| Mode | Security | Effort for your developers | When to choose it | |
|---|---|---|---|---|
| A | Server-to-server exchange | High | Minimal — one HTTPS call | The recommended choice in most cases |
| B | Signed token — shared secret (HS256) | High | Low — sign a JWT | If you would rather not call our server on every page load |
| C | Signed token — public key (RS256) | High | Medium — manage a key pair | If your security policy forbids sharing any secret |
| D | Declared identity | No verification | Almost none | Personalization only, with non-confidential data |
If you have no particular constraint, use Scenario A. B and C give the same guarantee with a different kind of work. Scenario D protects nothing and is only for cases where the data at stake is not sensitive.
Whichever scenario you pick, three things come first, once:
- A working embedded chat — the assistant is already in your site as an iframe, using the snippet from the endpoint's embed section.
-
An authorized domain — your site's origin (for example
https://portal.example.com) is listed in the endpoint's embed authorized domains. Without it the browser blocks the iframe. - Console access with a user who can edit the agent and its endpoints.
All identity configuration happens in the console: open the agent, expand the endpoint, and find User identity verification (embed).
The base URLs and the identifiers used in the examples below (
company-id,topic-id,agent-id,endpoint-id) are provided by Hevolus together with your embed snippet.
How it works. Every time a user opens the page carrying the chat, your server asks XRCopilot for a pass: "I am about to let this person in — give me a token". XRCopilot replies with a single-use session token valid for a few minutes. Your server puts it on the iframe URL. When the chat opens, XRCopilot recognizes the token it issued itself, and from that moment the session belongs to that user.
There is no cryptography on your side — you only need to make an HTTPS call from your backend. The token is single-use and short-lived, so intercepting it is of little value.
Console configuration, once: set Verification mode to Server-to-server exchange, optionally adjust the session lifetime (300 seconds by default), keep Require identity on if the chat must work only for known users, then enable Generate embed API key on save and save. Copy the embed API key immediately — it is shown once and stored only as a hash. If it is ever lost or exposed, use Rotate embed API key: the old one stops working at once.
What your developer does, on every page load. First, the backend asks for a session token:
curl -X POST "<XRCOPILOT_API_BASE>/embed/identity/company-id/endpoint-id/sessions" \
-H "Ocp-Apim-Subscription-Key: <YOUR_API_KEY>" \
-H "X-Embed-Api-Key: <YOUR_EMBED_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"userId": "user@example.com",
"context": { "email": "user@example.com" }
}'The response carries the token and its lifetime:
{ "sessionToken": "…", "expiresInSeconds": 300 }Then the token goes on the iframe URL, rendered server-side:
<iframe
src="<XRCOPILOT_CHAT_BASE>/company-id/topic-id/agent-id/endpoint-id/public?embedSession=…"
style="width:100%;height:600px;border:0;border-radius:12px"
title="Assistant" allow="microphone">
</iframe>That is all. On open, the chat resolves the token and the session is that user's.
Watch out for. The call above must be made from your server, never from the browser — the embed API key must never reach the client. The token is single-use: if the user reloads, your server requests a new one (a call of a few milliseconds). If a token is expired or already used, the chat shows a session-expired message and reloading the page from your site is enough.
How it works. Instead of asking XRCopilot for a pass, your server writes the ticket and signs it, using a shared secret known to you and to XRCopilot. Without the secret nobody can produce a valid signature, so nobody can impersonate your user. The ticket is a standard JWT, for which every language has a ready library.
Console configuration, once: set Verification mode to Signed token — shared secret (HS256), paste a strong random secret into the shared secret field (the same value goes on your server), and optionally set the UserId claim (which claim carries the user id, sub by default), the context claims to forward (for example email) and an expected issuer. On save the secret is encrypted and never shown again: paste a new value to change it, leave the field empty to keep it.
What your developer does, on every page load. Sign a short-lived token — the example uses Node and jsonwebtoken:
const jwt = require("jsonwebtoken");
const token = jwt.sign(
{
sub: "user@example.com", // who the user is
email: "user@example.com", // optional extra context
aud: "endpoint-id", // which endpoint it is for
exp: Math.floor(Date.now() / 1000) + 300 // expires in 5 minutes
},
process.env.XRCOPILOT_EMBED_SECRET, // the shared secret
{ algorithm: "HS256" }
);Then pass it on the iframe URL as ?embedToken=<token>, exactly as in Scenario A. XRCopilot checks signature, expiry and audience; if everything holds, the session is that user's.
Watch out for. The token must always carry a short expiry (exp) — five to ten minutes is plenty, it only has to open the session. The secret lives only on servers, yours and ours, never in the page's JavaScript. If you change the secret in the console, update your server at the same time.
How it works. Identical to Scenario B with one difference: instead of a shared secret you use a key pair. Your server signs with the private key, which never leaves your systems; only the public key is registered in XRCopilot, and a public key can verify signatures but not produce them. This is the variant preferred by teams with strict requirements, because not even XRCopilot holds the material that signs the tickets.
Configuration. Generate the pair, for example:
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pemprivate.pem stays with you, well guarded; public.pem can be shared. In the console set Verification mode to Signed token — public key (RS256) and paste the contents of public.pem into the dedicated field. Your server code is the same as Scenario B, changing only algorithm and key:
const token = jwt.sign(
{ sub: "user@example.com", aud: "endpoint-id", exp: Math.floor(Date.now()/1000) + 300 },
fs.readFileSync("private.pem"),
{ algorithm: "RS256" }
);Delivery to the iframe is identical: ?embedToken=<token>.
Watch out for. To rotate keys, generate the new pair, update the public key in the console, then switch your server to the new private key. The private key is never sent to anyone — not to Hevolus either.
How it works. The page simply passes context to the chat, with no proof. No ticket, no signature: the chat trusts what it receives.
To be explicit: anyone who knows the iframe URL can declare any identity. This mode therefore protects no data. It fits only when the information personalizes the experience and unlocks nothing confidential.
The test to decide whether it is enough. Ask: "if a stranger who knows a customer's email saw what that customer sees in the chat, would that be a problem?"
- No — for example the assistant only knows this person prefers properties in the north of the city, and tailors its suggestions → Scenario D can do.
- Yes — cases, amounts, documents, personal data → you need A, B or C.
Beware of drift over time: data that is "not sensitive" today tends to become sensitive tomorrow, when somebody adds one more field to the CRM. When in doubt, start from Scenario A.
How it is used. This mode needs no endpoint configuration: the values travel with the chat request through the public SDKs (the UserId and McpContext fields — see SDK-Overview) or, for embeds, as indicated by the Hevolus team. The rest of the chain, forwarding to the CRM, works exactly as in the other scenarios — simply with no guarantee about the identity.
Recognizing the user is half the job. The other half is making the tool that reads your data — technically an MCP server, the connector between the assistant and an external system — receive that identity and filter its results.
Step 1 — Turn forwarding on, on the connector. In the console, open the CRM's MCP server configuration and enable Forward user context. From then on every call to that connector carries the chat user's identity, as X-User-Context-* headers; the user id always arrives under the key user-id. Two guarantees matter here: forwarding is off by default and enabled connector by connector, so no user data goes to connectors that do not need it; and the forwarded identity identifies the user, it does not authenticate the service — the connector keeps reaching the CRM with its own credentials as always.
Step 2 — The connector filters. Whoever built the CRM connector — you, Hevolus or a supplier — reads the identity header and uses it as a filter: return only this person's cases.
Step 3 — Agree the join key. Decide which value links the user of your site to the user in the CRM. Usually it is the email; if your CRM keys on an internal customer code, pass that instead — in the context of Scenario A, or as a context claim in Scenarios B and C.
The whole picture:
User signs in on portal.example.com
│
▼
Your server produces the ticket (session token or signed JWT)
│
▼
The chat iframe presents it; XRCopilot VERIFIES it
│
▼
The chat session "is" that user
│
▼
User asks: "which cases do I have open?"
│
▼
The assistant queries the CRM connector, attaching the verified identity
│
▼
The connector filters: cases WHERE customer = that user
│
▼
The user sees only their own cases
Do we have to change our login system? No. Whatever you use is fine — XRCopilot never interacts with your login system. All that is needed is that your server, after the login, produces the ticket.
What happens if someone opens the iframe URL with no ticket? With Require identity on, the chat does not start and invites the visitor to reload the page from your site. With the option off, the chat works anonymously, as a classic embed, with no access to personal data.
And if the ticket is expired or tampered with? Verification fails and the chat is blocked. There is no "partly verified" case: either the guarantee holds, or the user stays unrecognized.
Can a session token be stolen and reused? It is single-use and lasts minutes: once the chat has opened it, it is spent. The practical risk is very low; for the most delicate data we still recommend A, B or C with Require identity on.
Our embed API key ended up somewhere it should not have. Now what? In the console, in the User identity verification (embed) card, use Rotate embed API key: the old one is invalidated instantly. Then update your server with the new one.
Can we use different modes on different endpoints? Yes — the configuration is per endpoint. You can have an anonymous public endpoint for the marketing site and an authenticated one for the customer area.
What extra data can we pass besides the identity? Simple, non-confidential key/value pairs: email, department, customer code, language. Never passwords, access tokens or other secrets.
How much work is it for our developers? Scenario A is one HTTPS call and one iframe parameter — typically under a day, testing included. Scenarios B and C are a little more, for token and key handling.
| Term | Meaning |
|---|---|
| iframe | The HTML frame through which the XRCopilot chat is placed in a page of your site |
| Endpoint | A specific entry point configured for an agent, with its own URL, QR code and settings |
| Embed API key | The credential your server uses to request session tokens (Scenario A). Shown once, at generation |
| Session token | A single-use, short-lived pass issued by XRCopilot at your server's request |
| JWT | The standard format for digitally signed tickets, used in Scenarios B and C |
| Shared secret | A secret string known only to your server and to XRCopilot, used to sign tokens (Scenario B) |
| Public / private key | A key pair: you sign with the private key, XRCopilot verifies with the registered public key (Scenario C) |
| MCP server | The connector through which the assistant reaches an external system — CRM, ERP, knowledge base |
| Forward user context | The option that attaches the chat user's identity to calls towards a connector, so data can be filtered |
For the detailed technical values of your environment — base URLs, identifiers, keys — refer to the material provided by the Hevolus team together with your embed snippet.
© Hevolus Innovation · XRCopilot · Maintained by the XRCopilot team.
Getting Started
API
SDKs
Webhooks & Integrations
- Agent Task Webhooks
- Connections & Action Steps
- Integration Templates
- Authenticated Embed
- Microsoft Agent 365
- Microsoft Teams Notifications
No-code Builders
Orchestrators
Processes
Administration
Reference