Sign the JWT
The contract is the same everywhere: read your user’s session, then sign a new JWT (HS256) with your signing key and the visitor’s email. Start with your language, then check your auth provider for how to read the user.Let Your AI Add It
Most teams wire this up with an AI coding assistant. Copy the prompt below into yours (Cursor, Claude Code, Copilot, and similar). It inspects your stack first, asks if anything is unclear, then writes the signing code for you.Prompt for your AI assistant
Any Backend
Required:email (lowercase) and exp. Recommended: name. The signing key comes from a backend secret (BESTCHATBOT_SIGNING_KEY).
token to the widget with setUserToken(token) or the data-user-token attribute. See Visitor Identity.
By Auth Provider
Each provider differs only in how you read the signed-in user. Once you have the email, sign the token with one of the snippets above.WordPress
WordPress
Easiest path: install the BestChatBot plugin, paste your signing key in its settings, and it injects the widget and mints the token for you (including WooCommerce email and phone). No code needed.To do it by hand, sign in the footer for logged-in users:
Clerk
Clerk
Read the Clerk user server-side, then sign your own token.
Firebase
Firebase
Verify the Firebase ID token first, then sign.The frontend sends the Firebase ID token to your endpoint; your endpoint returns the BestChatBot JWT.
Supabase Auth
Supabase Auth
Read the user with
getUser() (not getSession()), then sign.Auth0
Auth0
Read the Auth0 session server-side, then sign.
Next Steps
Visitor Identity
The contract, security rules, and how to deliver the token.
Members & Roles
Control who on your team can manage the widget.

