How It Works
Every framework follows the same pattern:- Import or load the web component
- Add
<char-agent>to your template - Call
connect({ idToken, clientId })orconnect({ ticketAuth })to authenticate
The agent is framework-agnostic because it’s a standard web component. If your framework can render custom HTML elements, it can use Char.
Vanilla JavaScript
No framework? No problem:- Script Tag
- ES Module
- npm + Bundler
React Ecosystem
Other Frameworks
Vue
Vue 3 Composition API with Nuxt SSR
Angular
Standalone components with CUSTOM_ELEMENTS_SCHEMA
Svelte
Svelte 4/5 with SvelteKit SSR
Solid
SolidJS with SolidStart SSR
Partial Page Update Frameworks
For frameworks that do partial page updates, place the agent outside the swap target to preserve conversation state across navigations.HTMX
HTMX with Flask, Django, Go
Hotwire
Rails Turbo with Stimulus
Livewire
Laravel Livewire with Alpine.js
LiveView
Phoenix LiveView with HEEx
Key Concepts
SPA vs SSR Authentication
| Architecture | Auth Method | When to Use |
|---|---|---|
| SPA | connect({ idToken, clientId }) | Client-side auth (IDP SDK returns JWT to browser) |
| SSR | connect({ ticketAuth }) | Server-side auth (session cookies, server-rendered pages) |
Using connect() vs Attributes
Always prefer theconnect() method over HTML attributes:
connect() method stores tokens as JavaScript properties, protecting them from session replay tools and DOM inspection.
Persisting Across Navigation
For partial page update frameworks (HTMX, Hotwire, Livewire, LiveView), place the agent outside the swap target:See Also
- Embedding the Agent - Vanilla JS and detailed authentication guide
- Identity Providers - Get ID tokens from Okta, Auth0, Azure AD, etc.

