The JS Plugin can reuse non-completed verifications with sessions. By tying users with sessions, multiple attempts at verification will not generate unnecessary verification jobs. Sessions are uniquely identified by the time limited token property. The steps to enable sessions are:

  1. Set the property crossDevice: true
  2. Define onInit callback to forward the token to your backend.
// initialize Vouched
var vouched = Vouched({
  /* other properties */

  onInit: ({token, job}) => {
    // If crossDevice is true, a web token is created during initialization 
    // Your backend will save and associate the token the user.
    fetch(`/yourapi/idv?job_token=${job.token}&&user=${user.id}`);
    console.log('initialization');
  }            

});
  1. Initialize the token if the user has a previously saved one.
var token = null;

// Assuming the user profile contains the previously 
// store user information, get the token from the user profile
if( user.token ){
  token = user.token;
}
// initialize Vouched
var vouched = Vouched({
  /* other properties */

  token: token
});

Did this page help you?