Integrating Verisoul in Web Applications
<head>
as early as possible to ensure the Verisoul object is available on the window before calling Verisoul functions.
{env}
: Use either prod
or sandbox
{project_id}
: Your project ID, which must match the environmentsession_id
when you need to make a prediction or reinitialize a session when an account logs out.
session_id
to uniquely identify each user session. The session_id
is required when you need to get a risk prediction from the backend API and must be passed from your client to the server.
You can get the current session_id
at any time by calling Verisoul.session()
. The function returns a promise that resolves once Verisoul collects a minimum amount of session information to make a prediction.
Important: Each session_id
expires after 24 hours and cannot be used to call the backend API after expiration. It is recommended to only get a session_id
right before you need to make a server-side request.
Example usage:
reinitialize()
function is optional for most use cases.session_id
only be tied to one account. To avoid problems joining a session to an account, reinitialize the session once an account logs out.
Calling Verisoul.reinitialize()
generates a new session_id
, which ensures that if a user logs out of one account and into a different account, Verisoul will be able to delineate each account’s data cleanly.
Example usage:
account()
function provides a simplified way to send user account information to Verisoul directly from the client side. While easy to integrate, this method has important limitations:
account()
is only visible in the Verisoul dashboardid
field is required.
Example usage: