Use this guide for the canonical embed contract.
Auth contract (current)
publishableKey: required
idToken: optional
<char-agent> handles ticket exchange internally through POST /api/auth/pk-ticket.
Install
Key-only embed
This gives org-scoped access without per-user identity.
Per-user identity embed
React (@mcp-b/char-react)
Security notes
- Keep
idToken out of DOM attributes; pass it via connect()/setAuth().
- Treat publishable keys as public embed credentials and rotate if exposed unexpectedly.
- Restrict key usage with allowed origins in dashboard settings.
Troubleshooting
MISSING_PUBLISHABLE_KEY: provide publishable-key or connect({ publishableKey })
INVALID_KEY: key is revoked/invalid
ORIGIN_NOT_ALLOWED: add the origin to allowed origins/domains for that key
INVALID_TOKEN/TOKEN_EXPIRED: refresh user session and pass a fresh idToken