Mint the identity token on your server
Use the workspace identity-verification secret to sign an HS256 JWT. The subject must equal theuserId passed to Dubot.init(), and expiration must be no more than seven days in the
future. Shorter lifetimes are recommended.
Observe before enforcing
Workspace settings can observe or enforce signed identities separately for Test and Production.- Observe records whether identified sessions present a valid signature without blocking unsigned traffic.
- Enforce rejects missing, invalid, expired, or mismatched identity tokens.
getState().initProps.verified means the browser supplied a non-empty identity token. It does not
prove the server accepted that token. Verify acceptance with a successful authenticated request
and the workspace identity coverage view.
Recover from an enforcement failure
If Enforce blocks intended users, return the affected environment to Observe while you repair the integration. Confirm the user id and JWT subject match, mint a fresh token with the current secret, and watch coverage before enabling Enforce again. Rotating the secret is appropriate only when you intend to invalidate every outstanding token.Supply session context
context is a flat map of scalar values. The current SDK bounds it to approximately 2 KB and
drops nested values or overflow with a console warning.
setContext() replaces the complete context set. Rebuild and send the full current snapshot
when the host state changes.
For a single-page application, update the snapshot after route or relevant account state changes;
do not call init() again only to refresh context.
Email is used for identity attribution when passed to
init(). It is not automatically copied
into assistant context. Add only the context fields the experience actually needs.Renew an identity token
Your application obtains fresh tokens from its authenticated backend; the SDK does not mint or schedule their renewal. Before the token expires, callinit() with the same user’s full options
and the new token:
currentDubotOptions is the complete initialization configuration maintained by your application.
When only the token changes, the SDK refreshes it without remounting placements and reconnects
the action channel as needed. A changed user or other initialization options can restart the
configuration lifecycle. Use setContext() or setActions() for their respective updates.
Log out or switch accounts
End the old user’s Dubot session as part of logout or account switching:destroy() is terminal for the installed instance. Calling init() afterward is ignored, and
inserting the CDN script again in the same document is treated as a duplicate install. Use a
full page reload when you need a fresh instance. For an application that must switch users
without navigation, review its reinitialization and conversation-isolation behavior with Dubot
before rollout.