Integrate Identity Verification with the Didit JavaScript SDK
Learn how to seamlessly integrate identity verification into your web application using the Didit JavaScript SDK. This guide covers installation, setup, and implementation with code examples, ensuring a smooth and secure user.

Contents
In this guide
Jump to the part you need.
Easy IntegrationThe Didit JavaScript SDK offers a simple API and flexible integration methods, allowing you to quickly add identity verification to your web application.
Enhanced SecurityUtilize Didit's advanced features like ID Verification and Liveness Detection to protect against fraud and ensure secure user onboarding.
Customizable ExperienceConfigure the SDK to match your application's look and feel, providing a seamless and consistent user experience.
Core KYCDidit enables you to start verifying identities without upfront costs, leveraging our AI-native, modular platform.
Introduction to the Didit JavaScript SDK
The Didit JavaScript SDK provides a programmatic way to integrate identity verification directly into your web applications, offering full control over the user experience. Whether you're building a React, Angular, or vanilla JavaScript application, the SDK simplifies the process of verifying user identities, enhancing security, and ensuring compliance. With Didit's AI-native platform, you can leverage features like ID Verification, Passive & Active Liveness, and more, all through a clean and easy-to-use API.Installation and Setup
Before you begin, ensure you have a Didit account and have created a workflow in the Didit Console. The SDK can be installed via NPM, Yarn, or directly through a CDN. Here’s how to get started:NPM/Yarn
To install using NPM or Yarn, run the following command: ```bash npm install @didit-protocol/sdk-web # or yarn add @didit-protocol/sdk-web ```CDN (UMD)
Alternatively, you can include the SDK directly in your HTML file using a CDN: ```html ```Implementing Identity Verification
Once installed, you can implement identity verification in your application. Here’s a basic example using vanilla JavaScript: ```html ``` This code snippet demonstrates how to initialize the SDK, set up a completion callback, and start the verification process using a UniLink URL. The UniLink URL can be obtained from the Didit Console.Advanced Configuration and Customization
The Didit JavaScript SDK offers various configuration options to tailor the verification process to your specific needs. You can enable logging for debugging, customize the container element for the modal, and set the z-index. Here’s an example of advanced configuration: ```typescript DiditSdk.shared.startVerification({ url: 'https://verify.didit.me/session/session-token', configuration: { loggingEnabled: true, zIndex: 10000, showCloseButton: false } }); ``` Furthermore, Didit’s modular architecture allows you to leverage specific identity primitives such as ID Verification (OCR, MRZ, barcodes), Passive & Active Liveness, and 1:1 Face Match, ensuring a comprehensive and secure verification process.Handling Verification Results
TheonComplete callback function is crucial for handling the results of the verification process. It provides information about whether the verification was completed successfully, cancelled, or failed. Here’s how you can handle the results:
```typescript
DiditSdk.shared.onComplete = (result) => {
switch (result.type) {
case 'completed':
console.log('Verification completed!');
console.log('Session ID:', result.session?.sessionId);
console.log('Status:', result.session?.status);
break;
case 'cancelled':
console.log('User cancelled verification');
break;
case 'failed':
console.error('Verification failed:', result.error?.message);
break;
}
};
```
This callback allows you to update your application's state, display appropriate messages to the user, and take any necessary actions based on the verification outcome. For instance, if you are verifying age, you can use Didit's Age Estimation feature alongside the ID Verification to ensure the user meets the required age threshold.
How Didit Helps
Didit simplifies identity verification with its AI-native, developer-first platform. Our modular architecture allows you to plug-and-play various identity checks, creating orchestrated workflows tailored to your specific needs. With Didit, you can automate trust and reduce manual review, saving time and resources. Key Didit products that enhance identity verification include: * ID Verification: Accurately extracts and validates data from various ID documents using OCR, MRZ parsing, and barcode decoding. * Passive & Active Liveness: Prevents fraud by ensuring the user is a real person and not a bot or a deepfake. * Age Estimation: Enables privacy-preserving age verification, crucial for industries requiring age compliance. Didit offers a Core KYC tier, allowing you to start verifying identities without setup fees. Our platform is designed to be global by design, ensuring compliance and security across different regions.Ready to Get Started?
Ready to see Didit in action? Get a free demo today.
Start verifying identities for free with Didit's free tier.
Try it
Try this in the sandbox
Run the check this guide describes, free.
The product this post is about, taken from its topic. Run it free in the sandbox.
Author
Alejandro Rosas
Co-founder and CTO

Questions
Blog questions
Who writes the Didit blog?
Which topics does the blog cover?
Is the blog available in my language?
Where do I find product updates?
Are these posts legal advice?
How do I find posts on one topic?
Are posts dated?
Do posts link to the docs?
Is the blog the same as the docs?
Compliance built in
Audited, certified and attested.
We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center
- Regulation encoded into your flows
Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.
- Ready for AMLR
Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.
- Tested in Spain's Treasury sandbox
Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.
- Audited, not self-declared
iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.
Your obligations · 3 regions
SOC 2 Type 2
ISO 27001
iBeta Level 1 and Level 2
EU regulator attestation
FSM youth protection
GDPR
EBA remote onboarding
MiCA compatible
FIDO Alliance member
- AMLREU AML Regulation ready
Integration · Didit MCP
Run Didit from your own AI agent
Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.
- Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
- Run investigationsAsk why a session was declined, review cases, search people and companies.
- Change rulesCreate payment rules, test them on past data and switch them on.
- Pull reportsAsk for numbers, exports or the audit log.
Didit Academy


