▸ clearUser(options?): Promise<boolean>
Clears the user context for all subsequent events in the browser session
| Name | Type | Description |
|---|---|---|
options? | Object | Reserved for future use |
Promise<boolean>
Indicates if the call succeeded
▸ setAuthenticatedUser(userId, options?): Promise<boolean>
Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared). It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required)
| Name | Type | Description |
|---|---|---|
userId | string | Opaque identifier of the user in your system |
options? | Object | Reserved for future use |
Promise<boolean>
Indicates if the call succeeded
▸ triggerActionEvent(actionType, options?): Promise<ActionResponse>
Reports a user action event to the SDK
| Name | Type | Description |
|---|---|---|
actionType | string | Type of user action event that was predefined in the Mosaic server |
options? | ActionEventOptions | - |
Promise<ActionResponse>
Indicates if the call succeeded
▸ getSessionToken(): Promise<string>
Get a session token, which can be used to trigger an action event via backend API. Requires setting enableSessionToken to true in the SDK configuration.
Promise<string>
The session token.
▸ getSecureSessionToken(actionType?, expirationSeconds?): Promise<string>
Get a secured session token, the recommended token type for backend integrations. It adds device binding and stronger protection against token theft and replay compared to the regular session token.
| Name | Type | Description |
|---|---|---|
actionType? | string | null | Optional. Binds the token to a specific action type (e.g., "login", "transaction"). Default: null. |
expirationSeconds? | number | Optional. Sets the token validity period in seconds. Default: 300 (5 minutes). Max: 3600 (60 minutes). |
Promise<string>
The secured session token (JWT).