Skip to content

JWT embed verification

JWT embed verification lets you pass verified user identity from your website to the Chatevo widget — so the assistant knows who is chatting without exposing credentials in the browser.

ScenarioBenefit
Logged-in customer portalPersonalize replies, access order history tools
Member-only areasBlock anonymous widget use on protected pages
Audit requirementsTie conversations to known user IDs

Enable per deployment under Deployments → Web widget → Security → Require identity verification.

sequenceDiagram
participant Your Server
participant Browser
participant Widget
participant Chatevo API
Your Server->>Browser: Page HTML + short-lived JWT
Browser->>Widget: Chatevo.setIdentityToken(jwt)
Widget->>Chatevo API: Message + Authorization Bearer JWT
Chatevo API->>Chatevo API: Verify signature + claims
  1. Your server signs a JWT with the deployment shared secret.
  2. The page passes the token to the widget via Chatevo.setIdentityToken().
  3. Widget API requests include Authorization: Bearer <jwt>.
  4. Chatevo verifies signature, expiry, and required claims before processing.
Claim / propertyRequirement
AlgorithmHS256 (shared secret) or RS256 (public key uploaded)
subStable user ID in your system
expExpiration — max 1 hour recommended
iatIssued-at timestamp
deployment_idMust match the widget deployment (optional but recommended)
{
"sub": "user_9281",
"email": "customer@example.com",
"name": "Jane Doe",
"deployment_id": "dep_abc123",
"iat": 1752652800,
"exp": 1752656400
}
const jwt = require("jsonwebtoken");
const token = jwt.sign(
{
sub: user.id,
email: user.email,
name: user.name,
deployment_id: "dep_abc123",
},
process.env.CHATEVO_JWT_SECRET,
{ algorithm: "HS256", expiresIn: "1h" }
);

Pass token to your page template and call Chatevo.setIdentityToken(token) after the embed script loads.

<script
src="https://widget.chatevo.ai/chat.js"
data-deployment-id="dep_abc123"
data-api-base="https://api.chatevo.ai"
async
></script>
<script>
window.Chatevo?.setIdentityToken("{{ server_generated_jwt }}");
</script>

Refresh the token before expiry on long-lived pages (e.g. after session refresh).

RuleReason
Never expose the signing secret in client codeAnyone could forge identities
Use short expLimits replay window
Rotate secret on compromiseInvalidate all outstanding tokens
HTTPS onlyPrevents token interception

When JWT is required, requests without a valid token receive 401.