The Voltai Widget supports different authentication modes to fit your use case.Documentation Index
Fetch the complete documentation index at: https://docs.voltai.ai/llms.txt
Use this file to discover all available pages before exploring further.
Guest mode
Guest mode lets visitors use the chat without signing in. This is useful for public-facing support widgets where you want to minimize friction. Enable it with theenableGuestUser option:
- Users start chatting after a quick verification step the first time they open the widget or trigger a programmatic chat
- A temporary session is created automatically
- Chat history persists across page refreshes (stored locally)
- Guest users are limited to 5 questions before being prompted to sign in
Guest sessions are anonymous and have a 5-question limit. After reaching this limit, users will need to log in to continue chatting.
Bot protection with hCaptcha
To protect against automated abuse, the widget integrates with hCaptcha. When enabled, guest users complete a captcha challenge inside the widget before their guest session is created. This happens when:- Guest mode is enabled (
enableGuestUser: true) - hCaptcha is configured on your backend
- The user opens the widget or a programmatic
sendChat()call needs a guest session
Authenticated users
For applications where users have accounts, the widget supports popup-based authentication. This allows:- Users to sign in with their existing credentials
- Conversations tied to their account
- Chat history synced across devices
- Personalized responses based on user context
- Unlimited questions (no 5-question limit)
Auth0 Connection
If you have a specific login method configured for your organization, you can specify which connection to use:authConnection is set, users are directed to that specific login method. When omitted, it displays its standard Login Widget with all available options.
Default organization selection
If authenticated users can belong to multiple organizations, you can tell the widget which organization to prefer after login:defaultOrgName is set, the widget looks for a case-insensitive match against the user’s available organization names. If no match is found, it falls back to the first available organization automatically.
How authentication works
- Widget loads — The SDK initializes and checks for existing sessions
- Session check — If a valid token exists locally, it’s restored
- Open or send — If no session exists and guest mode is enabled, opening the widget or calling
sendChat()shows the verification step - Guest session — After captcha succeeds, a guest token is fetched and stored locally for future visits
- Continue chatting — The chat UI appears and any queued
sendChat()request is submitted automatically
Programmatic authentication
You can check authentication status and trigger login programmatically from your code.Waiting for auth state
The widget exposes auth methods immediately, but auth restoration still happens asynchronously afterVoltai.load(). Use onAuthReady, auth:ready, or voltai.isAuthReady() when you need to make a decision based on the settled auth state before opening the widget.
Checking login status
UseisLoggedIn() to check if a user is signed in (returns false for guest users). If you care about startup timing, check isAuthReady() first:
Triggering login
Prompt users to sign in.voltai.login() is safe to call before the widget is opened:
Logging out
Listening for auth changes
Subscribe to authentication events to react when users log in or out:Example: Custom login button
Example: Check auth before opening the widget
onReadyis too early for auth decisions because it only means the widget mounted.onAuthReadyruns after auth restoration has settled.- If the widget is later opened while the visitor still has no session and
enableGuestUseris enabled, the guest captcha flow still happens inside the widget.
Handling authentication errors
If verification or authentication fails, the widget button still remains available and the open panel shows a retry path. Common issues:- Invalid API key — Verify your API key is correct
- hCaptcha failure — May occur if the user’s browser blocks the captcha script
- Network errors — Check connectivity to the backend
Security considerations
- API keys are visible in client-side code. They’re scoped to your domain and only allow widget operations.
- Guest tokens are short-lived and automatically refresh.
- hCaptcha adds a layer of protection against automated abuse.