Prerequisites
- HelpAlive is installed and your pages call
identify(). See Install the script. - A server that knows who is signed in.
- Your developer, about 15 minutes.
- An Admin on your HelpAlive team, to create the signing secret and turn on Only allow verified users.
The rules
- Sign the token on your server, never in the browser.
- Sign it with HS256, using the text of your signing secret as the key.
- Put the same id your page passes as
userIdinsub, as a string. - Put the same id your page passes as
tenantIdintenant, as a string. Leavetenantout if your app has no companies or workspaces. - Don’t add
kidor any other claim. Leave outexptoo, unless you also passrefreshUserTokentoidentify(). - Send the token only to the signed-in user’s own page, with
Cache-Control: no-store. - Pass the token to
identify()asuserToken, in place ofuserIdandtenantId. - Keep the secret out of your pages, your repository and any prompt for an AI coding agent.
- Keep
reset()in your logout code, apart fromidentify(), as before.
How to set up user verification
1
Create your signing secret
On Settings → Setup & API Key, step Verify your users, click Create your signing secret. Keep it on your server, like a password, wherever you keep other secrets. The code below reads it from 
HELPALIVE_SIGNING_SECRET, but you can use another name.
2
Make a user token on your server
Where your server knows the signed-in user, add these lines. They make the user token, a short signed text that says who the user is. On a CommonJS server, write The token is a JWT signed with HS256, using the text of your secret as the key:
user stands for your app’s signed-in user.- Node.js
- Python
- Ruby
- PHP
- Java
- Go
- C#
- Edge / Deno / Bun
const jwt = require("jsonwebtoken") in place of the import line.Leave out a key id (
kid). An expiry (exp) is optional. Without one, a token works until you rotate the secret twice, as How to rotate the secret explains. If you add one, also pass refreshUserToken to identify(). Otherwise, with Only allow verified users on, the agent stops working in a tab left open when its token expires. Where tokens could leak, a short exp with refreshUserToken limits how long a leaked one works.3
Get the token to the page
Send the token only to the page of the user it names. Print it into the page from your server template, or add it to an endpoint your app already has for the current user. Send that response with
Cache-Control: no-store.If you host software you don’t write, see What if the app is software you host?4
Pass the token to identify()
Replace your If your server can’t give a token, for example after an error or a timeout, still call
identify() call with this one. The token says who the user is and which company they belong to, so you no longer pass userId or tenantId.identify(). Pass userId and tenantId as before, without userToken. With Only allow verified users on, that person doesn’t see the agent. Step 4 on Settings → Setup & API Key counts them and names the cause.If you still pass a userId or tenantId that differs from the token, HelpAlive uses the ids in the token. The browser console shows a warning. A value that isn’t a JWT is ignored, with an error in the console. That catches the secret pasted in by mistake.Your logout code doesn’t change. Keep reset() there, apart from identify(), never straight after it:reset() also drops the token, so the next user on the same browser never inherits it.5
Add the secret to your environment
Add
HELPALIVE_SIGNING_SECRET to your server’s environment, with the secret from step 1 as its value. If your project keeps a list of variables, such as .env.example, add the name there with no value.With React, Next.js, Vue or Angular
The pages for React, Next.js, Vue and Nuxt and Angular each show how to pass the token in that framework.With Google Tag Manager
If you installed HelpAlive with Google Tag Manager, pass the token through the data layer. Create a Data Layer Variable namedhelpalive_user_token, then add these lines:
With an AI coding agent
The Verify your users step has a prompt for your AI coding agent under With an AI coding agent. It makes the token on your server, passes it toidentify(), and lists HELPALIVE_SIGNING_SECRET with no value. You set the value yourself, so the secret never goes into a prompt. The prompt is also on Install with an AI coding agent.
Check it works
- Deploy your change, sign in to your app and open the agent.
- On Settings → Setup & API Key, step Verify your users, press Check again on Check your setup. It looks for a verified sign-in in the last 30 minutes. If it finds one, it says your signing works.
- The Verified sign-ins, last 7 days card shows the share of sign-ins that arrived verified.
Only allow verified users
Until you turn this on, everyone can see the agent. Turn it on once every page that callsidentify() sends a token.
1
Wait for verified sign-ins
The switch unlocks once verified sign-ins arrive. It turns on only after a verified sign-in in the last 30 minutes. Sign in to your app and open the agent first.
2
Turn on Only allow verified users
It is at the bottom of the Verified sign-ins, last 7 days card. The switch shows Recommended when nearly all sign-ins are verified. The switch also says how many sign-ins it would have refused in the last 7 days.
3
Confirm
It asks first: “Hide the agent from anyone we can’t verify?” The dialog says how many people in the last 7 days had no token, or a token that had expired or didn’t check out. Press Turn it on anyway, or Show me the fix to open the setup instructions instead.
- A page without a valid token gets no chat button, so the user doesn’t see the agent.
- If a token expires while the chat is open, HelpAlive calls your
refreshUserTokenfunction and sends the request again. If you don’t pass one toidentify(), or it fails, the user sees “Your session needs a refresh. Reload the page to keep chatting.” The message has a Reload page button. - If an open chat is refused for any other reason, the question box goes away. In its place, the user sees “Chat isn’t available right now. Please try again later.” A running assist stops quietly.
- Activity from pages without a valid token is refused too. Those users stop showing in Reports, Audience and the setup steps.
How to rotate the secret
Click Rotate next to your secret and put the new one inHELPALIVE_SIGNING_SECRET on your server. Nothing in your code changes.
The previous secret keeps working until you rotate again, so nobody is refused while you roll it out. If a secret leaked, rotate once more after your server uses the new one, and the leaked one stops working. Then put that newest secret on your server too, or the tokens your server signs stop working at the next rotation.
What if the app is software you host?
Ready-made software you host, such as a code forge or a forum, may have no place where your code knows the signed-in user. Run a small token endpoint beside it instead:- Serve it on the same domain, for example at
/helpalive/user-tokenbehind your reverse proxy, so the browser sends the app’s session cookie. - In it, ask the app whose session that cookie belongs to, through the app’s own API. Never take a user id from the request itself.
- Sign
sub(andtenant) as text, as in step 2, and answer withCache-Control: no-store. - In the page, through the app’s custom-script setting or template, fetch the token with the session cookie and pass it to
identify().
Why does the card say no verified sign-in when the server signs tokens?
The card counts a verified sign-in only when someone uses the agent. Sign in, open the agent, and press Check again. Then check that the page passesuserToken to identify(), and that the response carrying it isn’t cached.
Why don’t some users see the chat button?
Only allow verified users is on, and their page sent no valid token. Step 4 on Settings → Setup & API Key names the main reason and the fix. Check that every page that callsidentify() sends a token, or turn the switch off while you fix it.
Why do users see Your session needs a refresh?
Their token expired and couldn’t be renewed. PassrefreshUserToken to identify() so HelpAlive can get a fresh one, or leave the expiry out of the token.
Why does the console say userToken is not a JWT?
The page passed something other than a signed token, often the secret itself. Pass the token your server made, and rotate the secret if it reached a page.Next
Identify users
Every identify() field.
Security
Public keys, secret keys and sessions.
Troubleshooting
When the agent doesn’t appear.

