Face Validation
Render a fullscreen capture component that analyzes frames from the user’s front-facing camera to determine whether a live human face is present.
Example
import React, { useState } from "react";
import { FaceValidation } from "idmission-web-sdk";
 
function getSessionId() {
  return fetch("/api/get-session").then(resp => resp.json()).then(resp => resp.id);
}
 
function MyComponent() {
  const [running, setRunning] = useState(false);
 
  return (
    <>
      <button onClick={() => setRunning(true)}>Start Face Validation</button>
 
      {running && (
        <FaceValidation sessionId={getSessionId} />
      )}
    </>
  );
}Props
langLanguage code to use. Supported values: ‘auto’ (detect based on user’s OS), ‘en’ (English), ‘es’ (Spanish). Defaults to auto.  | 
sessionIdA session identifier generated with your IDmission credentials.  | 
submissionUrlURL to hit with all API requests. Defaults to the value specified in your decoded submissionToken. | 
authUrlURL to validate session against. Defaults to https://portal-api.idmission.com.  | 
documentServiceUrlURL to upload captured documents to via Tus.  | 
companyIdCompany identifier to include with submission.  | 
jobIdThe ID of the job to associate with the submission.  | 
taskIdThe ID of the task to associate with the submission.  | 
needImmediateResponseBoolean flag to indicate if validation of the minimum resolution for an ID document image should be triggered. Defaults to true.  | 
webhooksEnabledBoolean flag to indicate whether customer-configured webhooks should be invoked after submission.  | 
webhooksURLURL to use when invoking customer-configured webhooks.  | 
webhooksClientTraceIdA customer provided trace id to use when invoking customer-configured webhooks.  | 
webhooksStripSpecialCharactersBoolean flag to indicate whether non-alphanumeric characters should be removed from the submission data when customer-configured webhooks are invoked.  | 
webhooksSendInputImagesBoolean flag to indicate whether raw user-captured images should be included in the submission data when customer-configured webhooks are invoked.  | 
webhooksSendProcessedImagesBoolean flag to indicate whether processed user-captured images should be included in the submission data when customer-configured webhooks are invoked.  | 
webhooksFireOnReviewBoolean flag to indicate whether customer-configured webhooks should be invoked upon ID being marked for manual review.  | 
webhooksFireOnReviewURLURL to use when invoking customer-configured webhooks when ID is marked for manual review.  | 
sendBase64DocumentsInSwaggerProxyBoolean flag to enable download and replace behavior for documents in the Swagger Proxy API. Defaults to false.  | 
useDocumentServiceForLivenessChecksBoolean flag to indicate whether the liveness check photos should be uploaded to the document service, rather than sent as base64. Defaults to false.  | 
estimateAgeBoolean flag to indicate whether the liveness check response should include an estimate of the user’s age. Defaults to false.  | 
predictGenderBoolean flag to indicate whether the liveness check response should include a prediction of the user’s gender. Defaults to false.  | 
loadingOverlayModeString indicating which loading overlay screen should be used. Supported values: ‘default’ and ‘legacy’. Defaults to ‘default’.  | 
initialCaptureDelayMsThe duration of time in milliseconds to wait after the loading overlay is dismissed before starting the capture experience. This helps with the problem of the first few frames being of the user looking down at the bottom of the screen but the frame otherwise being good. Defaults to 1000 (1 second). | 
timeoutDurationMsThe duration of time in milliseconds that the user may try to pass the realness check. Defaults to 15000 (15 seconds). | 
modelLoadTimeoutMsNumber of milliseconds indicating the maximum amount of time that should be spent trying to load the guided capture experience before giving up and resorting to the stock camera instead. Defaults to 45000 (45 seconds).  | 
skipSuccessScreenBoolean or async function to indicate whether to proceed automatically after capture guidance is satisfied. If an async function is supplied returning a boolean, it will be evaluated at the time of capture guidance satisfaction. Defaults to false. | 
idCardForFaceMatchString containing a base64 image or document service ID pointing to an ID card front image that should be used to match the user’s face against. Leave blank to disable face matching.  | 
onLoadingStartedCallback function that fires when the loading sequence begins.  | 
onLoadingProgressCallback function that fires when the loading sequence progresses.  | 
onLoadingCompletedCallback function that fires when the loading sequence completes.  | 
onLoadingFailedCallback function that fires when the loading sequence fails.  | 
onAuthErrorCallback function that fires when the session creation or validation fails.  | 
onBeforeDocumentUploadCallback function that fires immediately prior to each document upload, giving the client application an opportunity to specify custom asynchronous logic that captures the document contents before it is exchanged for a document token. The document content and metadata are passed in as parameters and a promise resolving to void or false should be returned. If the returned promise resolves to false, the document will not be uploaded.  | 
onDocumentUploadProgressCallback function that fires when progress information is available for a document upload. The progress info and metadata are passed in as parameters.  | 
onDocumentUploadedCallback function that fires immediately after each document upload, giving the client application an opportunity to specify custom asynchronous logic that captures the document token. The document token and metadata are passed in as parameters.  | 
onDocumentUploadFailedCallback function that fires when a document failed to upload. The error and metadata are passed in as parameters.  | 
onBeforeSubmitCallback function that fires immediately prior to liveness check, giving the client application an opportunity to specify custom asynchronous logic that mutates the request before it executes. The liveness check request is passed in as a parameter and a promise resolving to the updated request should be returned.  | 
onCompleteCallback function that fires when the user has completed the FaceValidation flow, regardless of whether they are approved or denied. Arguments: the SubmissionResponse from IDmission’s API is passed as an argument to the customer’s application for further handling, which indicates whether the user passed the validation check, and the request payload dispatched to IDmission’s API, which contains the images submitted by the user.  | 
onApprovedCallback function that fires when the user completes the FaceValidation flow and passes the realness check. Arguments: same as onComplete.  | 
onDeniedCallback function that fires when the user completes the FaceValidation flow and fails the realness check. Arguments: same as onComplete.  | 
onRequestFailureCallback function that fires when an error occurs during the submission process. Arguments: the Error object is passed as an argument to the customer’s application for further handling.  | 
onExitCaptureCallback function that fires when the user clicks the exit button during ID or selfie capture.  | 
onExitAfterFailureCallback function that fires when the user clicks the exit button after completing the FaceValidation flow and failing the realness check.  | 
onUserCancelCallback function that fires when the user clicks the exit button from the loading overlay, declining to engage with IDmission. Binding this callback results in the cancel button being rendered on the loading overlay.  | 
onModelErrorCallback function that fires when the selfie capture models fail to load or fail during runtime.  | 
onCameraAccessDeniedCallback function that fires when the camera access is denied.  | 
onCameraTamperingDetectedCallback function that fires when the camera tampering is detected.  | 
themeName of an included theme or object containing theme properties. *  | 
assetsObject containing any asset overrides.  | 
classNamesObject containing any classNames for inner components. *  | 
colorsObject containing any color overrides.  | 
verbiageObject containing any verbiage overrides.  | 
geolocationEnabledBoolean flag to indicate whether users should be prompted to share their location. Default is true. | 
geolocationRequiredBoolean flag to indicate whether users should be blocked from proceeding if they block location access. Default is false. | 
debugModeBoolean flag to enable on-screen prediction information output. Default is false. | 
Class Names
Assets
loadingOverlay.instructionImageUrlURL to the instruction image on the loading overlay. Defaults to https://websdk-cdn-dev.idmission.com/assets/Selfie-Image-1.png.  | 
loadingOverlay.cameraAccessDenied.imageUrlURL to the image to display when camera access is denied. Defaults to https://websdk-cdn-dev.idmission.com/assets/camera-disable-icon.png.  | 
loadingOverlay.microphoneAccessDenied.imageUrlURL to the image to display when microphone access is denied. Defaults to https://websdk-cdn-dev.idmission.com/assets/microphone-disable-icon.svg.  | 
failure.imageUrlURL to the image to display on the FaceLivenessFailure screen. Defaults to https://websdk-cdn-dev.idmission.com/assets/Face_Not_Detected.svg.  |