Passport Verification
BlockID Passport Verify allows developers to quickly and accurately confirm the identity information on a user's passport. Our helper SDKs can be integrated into your development environment and add this functionality in a few simple steps.
Using our helper SDKs, developers can initiate the passport verification process by sending an SMS containing a URL (and matching session) to our web-based application. Users follow the instructions on the application to take a photo of the ID page of their passport, followed by a selfie photo.
Please see our Passport Verification Demo Application in our developer sandbox for a hands-on demo of the passport verification process. This article is focused on configuring the backend to create the session and URL that users will use to access the passport verification scan.
Create a new Passport Verification Session
Parameters
dns
: tenant domain as shown in the dashboardcommunityName
: tenant community as shown in the dashboardlicenseKey
: tenant license key as shown in the dashboarddvcId
: tenant document verification configuration as shown in the dashboarddocumentType
: set asppt_object
smsTo
: phone number, including area codesmsISDCode
: international subscriber dialing code of the phone numbersmsTemplateB64
: base64-encoded SMS message to send, along with the URL to initiate the web-based passport scan (see example below)sessionId
: session ID returned by the API server for the passport scan
Request Format
All requests are plug-and-play, not copy-paste. Please ensure that you are replacing the parameters in the request format below with the actual values
First, we need to create a new session for passport verification. We've outlined the request format.
- NodeJS
- Set tenant info and document verification configuration (dvcID)
const BIDVerifyDocument = require('blockid-nodejs-helpers/BIDVerifyDocument');
const BIDMessaging = require('blockid-nodejs-helpers/BIDMessaging');
const dvcId = "<dvcId>";
const documentType = "ppt_object";
const tenantInfo = {
dns: "<tenant dns>",
communityName: "<community name>",
licenseKey: "<user license key>"
}
- Define the SMS message to send to users with the URL to initiate the passport verification web application
const sample_sms_template = "Hello Developer, please complete your document verification scan for Company Name by visiting <link>"
The <link>
parameter is just a placeholder and will be replaced with the actual URL below
- Create a session and generate a URL to initiate the web-based passport verification
async function createSessionAndTriggerSMS() {
let createdSessionResponse = await BIDVerifyDocument.createDocumentSession(tenantInfo, dvcId, documentType);
// Replace the URL placeholder in sms template.
console.log('createdSessionResponse:', createdSessionResponse);
const templateText = sample_sms_template
.toString()
.replace(/<link>/, createdSessionResponse.url);
const smsTemplateB64 = Buffer.from(templateText).toString('base64');
// Trigger SMS with DL Scan link to the provided phone number
let smsResponse = await BIDMessaging.sendSMS(tenantInfo, smsTo = "<smsTo>", smsISDCode = "<smsISDCode>", smsTemplateB64);
}
- Start polling session for passport verification, start face compare when
SUCCESS
is returned
The polling function will run until a SUCCESS
status is returned. See example polling responses
async function pollSession(sessionId) {
// Start poll session for passport scan + Live Id verification Response
let pollSessionResponse = await BIDVerifyDocument.pollSessionResult(tenantInfo, dvcId, sessionId);
console.log('pollSessionResponse:', pollSessionResponse);
// After receiving Success Response, start face_compare of passport image and liveid image
if (documentResponse.responseStatus === "SUCCESS") {
let document = {
id: pollSessionResponse.liveid_object.id,
type: "ppt",
image1: pollSessionResponse.ppt_object.face,
image2: pollSessionResponse.liveid_object.face,
purpose: "ppt_verification"
};
const faceCompareResponse = await BIDVerifyDocument.verifyDocument(tenantInfo, dvcId, ["face_compare"], document);
console.log('faceCompareResponse::', faceCompareResponse);
}
}
- Create session and trigger SMS
createSessionAndTriggerSMS();
Example Request
Dummy information is provided in this example
- NodeJS
const BIDVerifyDocument = require('blockid-nodejs-helpers/BIDVerifyDocument');
const BIDMessaging = require('blockid-nodejs-helpers/BIDMessaging');
const dvcId = "devx_57010000-ea00-4500-ab00-b86d22000000";
const documentType = "ppt_object";
const tenantInfo = {
dns: "blockid-trial.1kosmos.net",
communityName: "default",
licenseKey: "00000000-0000-0000-0000-000000000000"
}
//Define SMS message
const sample_sms_template = "Hello Developer, Please complete your document verification scan for Company by visiting <link>"
// Create verification session and URL
async function createSessionAndTriggerSMS() {
let createdSessionResponse = await BIDVerifyDocument.createDocumentSession(tenantInfo, dvcId, documentType);
// Switch URL placeholder with actual verification link in sms template
console.log('createdSessionResponse:', createdSessionResponse);
const templateText = sample_sms_template
.toString()
.replace(/<link>/, createdSessionResponse.url);
const smsTemplateB64 = Buffer.from(templateText).toString('base64');
// Trigger SMS with verification link to the provided phone number
let smsResponse = await BIDMessaging.sendSMS(tenantInfo, smsTo = "1234567890", smsISDCode = "1", smsTemplateB64);
return createdSessionResponse;
}
// Start poll session for passport scan + Live Id verification Response
async function pollSession(sessionId) {
let pollSessionResponse = await BIDVerifyDocument.pollSessionResult(tenantInfo, dvcId, sessionId);
console.log('pollSessionResponse:', pollSessionResponse);
// After receiving Success Response, start face_compare of passport image and liveid image
if (documentResponse.responseStatus === "SUCCESS") {
let document = {
id: pollSessionResponse.liveid_object.id,
type: "ppt",
image1: pollSessionResponse.ppt_object.face,
image2: pollSessionResponse.liveid_object.face,
purpose: "ppt_verification"
};
const faceCompareResponse = await BIDVerifyDocument.verifyDocument(tenantInfo, dvcId, ["face_compare"], document);
console.log('faceCompareResponse::', faceCompareResponse);
}
}
var sessionResponse = createSessionAndTriggerSMS();
await pollSession(sessionResponse.sessionId)
Server Responses
Responses include dummy data as an example of a typical response
A successful request should return a session ID, along with the URL that users should visit on their mobile device to initiate the passport verification scan.
Passport Verification Responses
- 200
- 401
- 403
- 404
{
"url": "https://multieastt.reauthid.com/MWA/index.html?token=c575f661-905f-49d9-bcf9-261ca0000000",
"sessionId": "c575f661-905f-49d9-bcf9-261ca0000000"
}
The API accepted the request and has returned a session ID and link to initiate the document verification process.
{
"error_code": 401,
"message":"Unauthorized"
}
The request was not authorized.
{
"error_code": 403,
"message":"Forbidden"
}
The user does not have appropriate permission to make this request. Please contact your tenant or community administrator for support.
{
"error_code": 404,
"message":"Unable to load tenant/community"
}
If the user encounters the message "Unable to load tenant/community" during the passport verification process, they can access the tenant and license key information configured on their user dashboard.
Polling Function Responses
- SUCCESS
- INPROGRESS
{
"responseStatus": "SUCCESS",
"sessionId": "0acc3890-7df9-4867-afda-0b5000000000",
"ppt_object": {
"type": "ppt",
"documentType": "Passport",
"category": "identity_document",
"documentId": "Y07PMRMJ6",
"id": "Y07PMRMJ6",
"firstName": "VIIALI",
"lastName": "MLIMSCHO",
"dob": "Invalid date",
"doe": "Invalid date",
"face": "fgRuQ1Lqkcn3cni76M77ER9iBfYNQ5vwf0qfPvHyWFiMAAAAASUVORK5CYII=",
"image": "",
"country": "DEU"
},
"liveid_object": {
"id": "com.blockid.liveid",
"type": "liveid",
"category": "identity_document",
"face": "fgRuQ1Lqkcn3cni76M77ER9iBfYNQ5vwf0qfPvHyWFiMAAAAASUVORK5CYII="
},
"token": "iVBORw0KGgoAAAAN/SUhEUgAAACAAAAAg="
}
{
"responseStatus": "INPROGRESS",
"sessionId": "0acc3890-7df9-4867-afda-0b5000000000",
"metadata": {
"requestID": "e8a4eba8-89a4-4b63-0000-719000000000",
"requestStatus": "INPROGRESS",
"uid": "2901d7af-e89f-47dc-98fd-fda000000000",
"transactions": [
{
"transactionStatus": "PENDING",
"executedDeletionRule": false,
"sequenceNumber": 0,
"transactionDetails": {
"documentType": "01",
"accountCode": "9999",
"reviewScreenFront": "true",
"reviewScreenBack": "true",
"enableSelfieCapture": "true",
"enableFarSelfie": "false",
"selfieCaptureAttempt": "3",
"transactionAttempts": "3",
"frontCaptureAttempt": "3",
"backCaptureAttempt": "3",
"requestExpiryTimeInMin": "4320",
"transactionExpiryTimeInMin": "60",
"frontCaptureMode": "Auto",
"backCaptureMode": "Auto",
"enableMutualTLS": "false",
"frontSetManualTimeout": "15",
"backSetManualTimeout": "10",
"C_RequestCreationDate": "14/Jul/2022",
"C_RequestCreationTime": "10:06:05"
},
"pii": {}
}
]
}
}
Face Compare Responses
- SUCCESS
- FAIL
{
"docId": "com.blockid.liveid",
"docType": "ppt",
"certifications": [
{
"docType": "ppt",
"docId": "com.blockid.liveid",
"type": "face_compare",
"ts": 1651751289793,
"verified": true,
"result": {
"id": "com.blockid.liveid",
"type": "ppt",
"category": "identity_document",
"confidence": 0.9920617938041687,
"minScore": 0.9
},
"metadata": {
"transactionId": "f4b48944-5476-430e-9487-291c612b990b",
"similarity": 0.9920617938041687
},
"token": "BZevuyUqEN4pUEJWMnhrPWiZyiAI+Il1FsrZNPzUqG5RjAKb5bVRdTGnl2LW/QOKE3YL+Aj4vegHOOQN9hFZssfuWKgNtHIEbST2uH7AqTbuW6CU+Ckli4SZTz75FGbSCDC38VmsdVlhCw+UVMExLq9Hb3J6u8oFyaA/HVuuxj0qo3CABXx/YEPv/8M/r0Ehn4IJuausX+aBap5z0iLCMfGrrphWy55KrbOiJj4bQfcqmtIkq2CqZHWA0l06oN9lw+hVUeyRdYYz0hIrhsazbT4NBQ4lEwXFc8SqrTSOLpQsgn3n3Hx7gbNmG0idD4wp2ZDy5NNoN7LmpahvUeFkYIBNscY5r16XoZmeRjYlwUZpc1cUJdRPQbGnu2f53M+Rhg3y5m4wIXRdMjkn+b6u8/fROp1O52jRRrrm2WNnb4OZhV3lryNPi9H6wc+58qvpfWcKu0BN0qobrAOm1//fp/X98446oSHMnDpXWM6yCGa/4A=="
}
]
}
{
"docId": "com.blockid.liveid",
"docType": "ppt",
"certifications": [
{
"docType": "ppt",
"docId": "com.blockid.liveid",
"type": "face_compare",
"ts": 1660886975259,
"verified": false,
"result": {
"id": "com.blockid.liveid",
"type": "ppt",
"category": "identity_document"
},
"metadata": {
"errorMessage": "RequestId: 2c921179-5152-4bb8-89d5-16557548dd34 Error: Runtime exited with error: signal: aborted",
"errorType": "Runtime.ExitError"
}
}
]
}