JavaScript SDK
JavaScript SDK
Integrate age verification into any website or web app using the official npm SDK.
JavaScript SDK
The @unqtech/age-verification-mitid package adds MitID-based age verification to browser applications.
It supports modern frontend apps built with npm as well as no-bundler setups through the UMD build. The SDK is browser-first: you initialize it with a public key, choose either redirect or popup verification, and then process the result on your callback page.
If you are starting from scratch, begin with Installation. That page replaces the older SDK quickstart and uses the current API.
If you need the same browser flow without installing the package, use Custom Integrations. That section documents the raw API contract the SDK wraps.
What the SDK handles
- Starting the MitID age-verification flow
- Validating returned JWTs in the browser
- Storing the verification token in a secure cookie
- Exposing helper methods such as
isVerified(),getVerifiedAge(), andresetVerification() - Routing non-success outcomes into structured callbacks
Supported environments
| Environment | Recommended path |
|---|---|
| Browser app with npm | Installation |
| SPA using full-page redirect | Redirect Flow |
| SPA that should stay on the same page | Popup Flow |
| Vite + React | React Examples |
| No bundler or CMS template | CDN Usage |
Choose your path
Redirect flow
Use redirect mode when you want the simplest setup.
- Best for: most websites and storefronts
- Behavior: user leaves the page, completes MitID, and returns to your
redirectUri - Docs: Redirect Flow
Popup flow
Use popup mode when you want to keep the current page visible.
- Best for: apps, gated modals, and embedded onboarding flows
- Behavior: the SDK opens a popup and sends the result back to the opener window
- Docs: Popup Flow
Before you integrate
- Create an account
- Create an API key
- Whitelist your domain
- Decide whether your app should use redirect or popup verification
What changed from the older quickstart
The older public quickstart describes an outdated SDK shape. The current SDK uses:
@unqtech/age-verification-mitidas the package namestartVerificationWithRedirect()andstartVerificationWithPopup()instead of genericstart()helpers- Granular callbacks such as
onDenied,onCancelled, andonError - Explicit callback-page handling via
handleRedirectResult()
Use Migration if you already implemented the older flow.