Skip to main content
Identity verification proves to Argide who the user is, so the agent can call your API as that user — “show my orders”, “cancel my subscription”. Your backend mints a JWT, the widget passes it to Argide, and Argide forwards it to your API on every tool call. This is the token flow behind JWT Forward.
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

  1. The user signs in to your app.
  2. Your backend mints an Argide identity token: a JWT signed with your product’s ARGIDE_AUTH_SECRET.
  3. Your frontend calls window.argide('identify', { token }).
  4. Argide verifies the token and links it to the user’s widget session. Their conversations show as Verified in Conversations.
  5. When the agent calls your API, Argide sends that token as Authorization: Bearer <token>.
  6. 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:
Never expose this secret in frontend code. Anyone who has it can mint tokens that impersonate your users.

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) or str(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.
If identify might run before the widget script has loaded, queue it instead: window.argide.push(['identify', { token }]). This needs the window.argide = window.argide || []; line from the install snippet. The widget runs queued commands as soon as it loads.

Keep the token fresh

Re-mint the token before exp 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.
  1. Open Tools → Server Side.
  2. Set Authentication to JWT Forward and click Save Configuration.
  3. Verify the token in your API with the same ARGIDE_AUTH_SECRET. See Verify the token in your API.
Without JWT Forward selected, identify succeeds but stores nothing. This is the most common reason identity appears to do nothing.

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

When identify 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