Flow
Create an embed key and identity secret
In the agent’s Embed tab, create a publishable
pk_live_... key, add your
site origin to the allowlist, and generate an identity-verification secret.
Store the secret on your server.Mint an identity token on your server
After your own login has authenticated the user, sign the exact
userId
string you will pass to the widget.Server-side identity token
The regular verified-identity token is a lowercase hex HMAC over the user id:attributes are still advisory metadata. The trusted part is the verified
userId because Karta recomputes the HMAC server-side before binding it into
the session token.
Widget wiring
Queueidentify before the widget opens its first session:
user_id and identity_token to the embed-token mint. If the
signature matches, Karta mints a short-lived session token with a trusted
subject. If the signature is wrong, minting fails instead of silently
downgrading a signed request.
Host-attested step-up
For sensitive approvals, your app can attest that the user recently completed your own step-up challenge. The browser still cannot invent this claim: your server signs it into a structured identity token. The structured token format is:identify again with
the same userId and the new identityToken:
stepped_up_at is recent and not in the future.
Worked example
Seeintegration/verified-identity-widget
for a small server-rendered app that:
- serves a signed-in demo page;
- mints verified identity tokens server-side;
- refreshes the widget identity after a simulated step-up;
- embeds the hosted Karta widget with no API key in the browser.
Safety checklist
- The embed key is publishable; the identity secret is server-only.
- The browser never sends a trusted user id without a matching server signature.
- A soft
userIdwithoutidentityTokenis metadata only. - Step-up claims are accepted only from a structured, signed identity token.
- Sensitive side effects should still use approval cards or first-party handoff, not direct agent execution.

