Gå til hovedindhold
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(), and resetVerification()
  • Routing non-success outcomes into structured callbacks

Supported environments

EnvironmentRecommended path
Browser app with npmInstallation
SPA using full-page redirectRedirect Flow
SPA that should stay on the same pagePopup Flow
Vite + ReactReact Examples
No bundler or CMS templateCDN 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

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

  1. Create an account
  2. Create an API key
  3. Whitelist your domain
  4. 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-mitid as the package name
  • startVerificationWithRedirect() and startVerificationWithPopup() instead of generic start() helpers
  • Granular callbacks such as onDenied, onCancelled, and onError
  • Explicit callback-page handling via handleRedirectResult()

Use Migration if you already implemented the older flow.

Next step

Install the SDK and run your first verification

On this page