If you only want the user’s name on their conversations, you don’t need any of this. See User identification — it needs no backend and no token.
How it works
- The user signs in to your app.
- Your backend mints an Argide identity token: a JWT signed with your product’s
ARGIDE_AUTH_SECRET. - Your frontend calls
window.argide('identify', { token }). - Argide verifies the token and links it to the user’s widget session. Their conversations show as Verified in Conversations.
- When the agent calls your API, Argide sends that token as
Authorization: Bearer <token>. - Your API verifies it with the same secret and knows which user is asking.
This is not your app’s session JWT. It’s a separate token your backend mints only for Argide, so your app’s own session token stays private.
1. Get your secret
In the dashboard, open Deploy → Backend Integration and click Copy secret next to ARGIDE_AUTH_SECRET. Add it to your backend environment:2. Create a token endpoint
Add an endpoint, behind your own login, that returns a fresh token for the current user.Token claims
- Sign with
HS256. Other algorithms are rejected. - The user ID must be a string. A numeric ID is ignored, and the token is rejected for having no user. Convert it with
String(id)orstr(id). - If you send more than one ID claim, Argide uses the first it finds, in the order
sub,userId,user_id. - A token without
exp, or one that has already expired, is rejected.
3. Identify in your frontend
Script tag
identify takes the token and an optional name. A name you pass here takes priority over the token’s name claim.
Call identify on every page load where the user is signed in, not only right after login. The token is tied to the widget’s session in this browser, so a new browser, a new device, or cleared site data needs a fresh one.
Keep the token fresh
Re-mint the token beforeexp passes. Once the stored token expires, Argide stops sending requests to your API for that user — the agent asks them to sign in again instead. With a one-hour token, refresh every 50 minutes:
Script tag
4. Enable JWT Forward
Argide only stores the token when your product’s API authentication is set to JWT Forward.- Open Tools → Server Side.
- Set Authentication to JWT Forward and click Save Configuration.
- Verify the token in your API with the same
ARGIDE_AUTH_SECRET. See Verify the token in your API.
5. Handle sign-out and user switches
Call one of the reset commands when the user signs out. The widget doesn’t detect your app’s sign-out on its own.
Both commands also clear
user_id, name, email, and custom attributes from window.ArgideSettings.
If a different person signs in on the same browser, you don’t have to reset first. When identify receives a token for a different user ID than the last one, the widget starts a new session automatically: it clears the previous conversation and revokes the previous user’s token before storing the new one.
Troubleshooting
Whenidentify fails, the widget logs a warning to the browser console that starts with [Argide-B2B].
If there’s no warning but your API still gets requests without an
Authorization header, check that Authentication is set to JWT Forward.
Next steps
Authentication
How Argide forwards the token and how to verify it
User identification
Name your users without a backend

