---
schema_version: "1"
id: 563cfa2ddc360f013ef2a1502016a224206f979699e7b7a2419aefba01c2f4a6
title: userVerificationAPI
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/messaging-web/references/userVerificationAPI.md
canonical_url: https://developer.salesforce.com/docs/service/messaging-web/references/m4w-reference/userVerificationAPI.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4bddde45c1105ab3de630e15e94d47ff0637eb6bd5ecc4f26819ac87fe7a9471
products:
  - Enhanced Web Chat
  - Service Cloud Developer Content
---
# userVerificationAPI

This object contains all the APIs associated with user verification. See [User Verification](/docs/service/messaging-web/guide/user-verification.html).

## clearSession

This method clears all messaging and user data from all tabs and windows.

### Parameters

Optional. To end the session for authenticated conversations, set `shouldEndSession` to `true`. To remove messaging components for unauthorized sessions, use the [`removeAllComponents`](https://developer.salesforce.com/docs/service/messaging-web/references/m4w-reference/utilAPI.md#removeallcomponents) API. The default is `false`.

### Example

```javascript
embeddedservice_bootstrap.userVerificationAPI
  .clearSession(true)
  .then(() => {
    // TO DO: Handle success
  })
  .catch((error) => {
    // TO DO: Handle error
  })
  .finally(() => {
    // TO DO: Handle regardless of result
  });
```

## `setIdentityToken({parameters})`

This method passes the user verification token to Salesforce. You must call this method for every tab or window that requires access to the authorized messaging conversation. Since the token is stored in the browser’s memory, call this method after a page refresh. Also, call this method with a renewed token when the token expires (see [`onEmbeddedMessagingIdentityTokenExpired`](/docs/service/messaging-web/guide/event-listeners.html)). You can also call this method before the token expires to renew the token proactively. This method must be called after the [`onEmbeddedMessagingReady`](/docs/service/messaging-web/guide/event-listeners.html) event is dispatched.

### Parameters

`{parameters}`: Required. A JSON object containing the identity token information.

| Parameter         | Type   | Description                                                                       |
| ----------------- | ------ | --------------------------------------------------------------------------------- |
| identityTokenType | string | The type of identity that is being provided. Currently, this value must be `JWT`. |
| identityToken     | string | The user identity token encoded using the RS256 algorithm.                        |

### Example

```javascript
embeddedservice_bootstrap.userVerificationAPI.setIdentityToken({
  identityTokenType: "JWT",
  identityToken: customer_signed_jwt,
});
```
