Web Library Examples
Frontpage Sample
Example demonstrate how use web capturing library
- Capture of a front side document with the following analysis of the document type.
- Capture of pdf417 from back side.
- Capture of face.
- Send this photos to DVS public endpoint and receive
requestId
- Send
requestId
on selfhosted backend and show validation result on popup window
For run application need installed Node.js and npm
How to run example:
- Download Demo App
- Extract archive
- Install dependencies:
npm install
- Set public key
pk_00000000-0000-0000-0000-000000000000
50 line\src\App\app.js
<DVS_PUBLIC_TOKEN>
->pk_00000000-0000-0000-0000-000000000000
fetch ('https://dvs.checkpointid.com/api/Request', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8',
'Authorization': 'Bearer <DVS_PUBLIC_TOKEN>'
},
body: JSON.stringify (request)
})
Replace <licenseKey>
22 line \src\App\app.js
this.state.component = new IDVC ({
networkUrl: 'networks',
el: 'videoCapturingEl',
licenseKey: '<licenseKey>',
types: ['ID'],
Note
Request an license key for the component and access to DVS server by emailing, specify the domain on which the application will be launched support@checkpointid.com
- Set your backend endpoint url 55 line
\src\App\app.js
.then (response => {
fetch ('http://localhost:3000/api/ValidationRequests/complete/', {
http://localhost:3000/api/ValidationRequests/complete/
- endpoint example of backend
- Run application
npm run start
Local server http://localhost:8080/
For local testing open this url on chrome with simulate a mobile viewport For testing on mobile
Backend Example
The backend receives a requestId from the frontend and sends a request for validation of documents uploaded from the frontend. Makes a decision based on the results of validation and passes the decision to the frontend.
For run application need installed Node.js and npm
- Download Backend Demo App
- Extract archive
- Install dependencies:
npm install
- Set secret key
sk_00000000-0000-0000-0000-000000000000
received from support<SECRET_KEY>
->sk_00000000-0000-0000-0000-000000000000
line 8 server.js
const token = process.env.DVS_SECRET_TOKEN || '<SECRET_KEY>'
- Run app
npm run server::start
Example backend in default listen port 3000
On line 5 const port = process.env.PORT || 3000;
you can change this
Endpoint for validation result http://localhost:3000/api/ValidationRequests/complete
Request:
{
"requestId": "gabrd1eb-4eab-4fea-8a66-1bdbdc018770",
"documentType": 1
}
Response:
{
"payload": object,
"status":false
}
Object payload contains full response from DVS
Read next: Using the REST API / Using the web library / Onboarding