---
updatedAt: 2025-11-13T22:07:18.000Z
agentTools:
  projectIndex: https://docs.vouched.id/llms.txt
---

# Sessions

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.

```javascript
// 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');
  }            

});
```

3. Initialize the `token` if the user has a previously saved one.

```javascript
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
});
```