Web SDK (React)
The Web SDK is a drop-in React component that renders the full verification UI (ID selection, document scan, and active liveness) and calls the verification API for you. It uses a publishable (pk_) key and detects the environment automatically from the key prefix (pk_test_* → sandbox, pk_live_* → production). For shared concepts (supported countries, branding, results, and errors), see Client SDKs.
Install
Each key goes to its own host: pk_test_ keys to https://sandbox-api.toden.co and pk_live_ keys to https://api.toden.co. If your Content Security Policy or proxy allowlists the SDK’s traffic, allow both.
Upgrading from the earlier package
@toden/react 4.0.0 is the first release under this name. Before it, the SDK was published as @myazahq/kyc-sdk-react, which receives no further releases.
- Remove
@myazahq/kyc-sdk-reactand install@toden/react. - Change your imports to
@toden/reactand@toden/react/styles.css. The API is unchanged, and the earlier names (MyazaKYC,useMyazaKYC,KYCErrorand the rest) still work as deprecated aliases. - Two capture defaults changed in 4.0.0. The document review screen is off unless a workflow or the
documentReviewprop turns it on (uploaded photos are still always reviewed), and a document is photographed only once all four of its corners are in view.
Usage
<Verification /> renders a “Verify Identity” button plus the full modal flow. The trigger is a real <button>: pass children to relabel it, className to restyle it, or any other button attribute (disabled, type, aria-*, …). See Customising the trigger button. Import the bundled stylesheet once, anywhere in your app.
Recommended: mount a workflow
Build the flow once in the dashboard as a workflow, then mount it by id. The country, ID types, capture steps, branding and copy all come from the workflow, so changing the flow is a re-publish rather than a redeploy.
userData is worth passing. It is the name you believe the user has, and it is compared against the name read off their document, and that comparison is what produces dataMatch on the verification. Leave it out and the check simply never runs: there is nothing to compare the document against, and dataMatch comes back null.
Pass email when you hold it. The flow never asks for it. It is the address your organisation can have the applicant emailed at about a decision, and it lets a returning person use an address they saved.
It cannot live on the workflow. userId, userData and metadata are per-user runtime values, and a workflow is a template shared by every visitor, so these stay in code even when everything else moves to the dashboard.
Or configure everything in code
Skip the workflow and pass the flow’s shape as props. Useful for a quick start or a single fixed flow; anything you’d change later means a redeploy.
Handling the result
Check with your backend before showing the flow, then give each ending its own screen. Handling results explains why.
Props
The liveness camera
The liveness camera takes the whole dialog while it is live, on desktop and on a phone: the face sits in a tall window, the rest of the picture is blurred, and the instruction is shown above the window. There is nothing to configure.
The step downloads its face tracking files when it opens. They are tried in order: your own host at <assetsBasePath>/face-mesh/ when you set assetsBasePath, then the Toden server, then a public CDN. If your site has a Content Security Policy, allow the Toden server in script-src and connect-src, and add 'wasm-unsafe-eval' to script-src: the face tracking runs as WebAssembly. Files from the Toden server do not need 'unsafe-eval'. Files from the public CDN do, so a policy that blocks the Toden server stops the step from loading. A Toden voice is fetched from the Toden server too, so connect-src already covers it.
Document capture
The capture steps need no configuration:
- A full-screen camera on phones. One top row holds back, the document and the side; an instruction shows what the camera needs; Upload, the shutter and Light sit along the bottom. The desktop camera uses the same controls.
- Cut-off documents. When the capture check finds that the document runs off the photo, the person is asked to retake it, with no “Continue anyway”: the verification would fail a cut-off document (
document_cut_off). For a face or barcode the check could not read, “Continue anyway” stays. From 4.4.0. - Sharper photos for the barcode. From 4.4.0 the camera asks a capable phone for 2560 by 1440 and keeps the photo at up to 2600 pixels, compressed once, so a card’s barcode can be read from it.
- A recording long enough to check. From 4.4.0 no photo of a side is taken until its recording has run about two seconds, so the server can compare the two. The back’s recording starts as the card is turned over, so the person does not wait.
- The cropper. Rotate turns the photo a quarter at a time, a NIN slip gets an upright box on phones, and on phones the cropper opens full screen. Its button reads “Use photo”.
- “Take a photo” uses the SDK’s own camera on desktop as well as phones, for proof of address, supporting documents and the entrance photo.
- Country and ID on one step. The person picks the country and the ID on the same screen.
Biometric re-authentication
A workflow on the biometric-authentication scope confirms it is really your user, matching a live selfie against the face you enrolled. Three options on the workflow, plus your own words for its screens, shape how the flow behaves, on the web exactly as on the mobile SDKs. All three live on the workflow’s Presence Intelligence panel in the builder, under Flow, so they need no code change; a prop-configured mount can pass the same biometric block.
- Where the verdict lands: In the app and on your webhook (the default) keeps the person on one loading screen from the moment the selfie is taken until the check settles, polling the status endpoint for up to a minute, then shows whether it was them; your app hears the verdict in
onResultand your webhook receives it as on every other flow. In the app only is the same wait, but the server sends no webhook for that check at all (verification.startedand the terminal events included), so the verdict is your app’s alone. Webhook only shows the ordinary submitted screen and leaves the verdict to your webhook. Enrolment workflows record the reference and have no verdict to deliver, so they never wait. - Selfie review: whether the captured selfie is shown back with Retake and Continue before it is sent. Off by default on the biometric scopes: a face check is a few seconds long, and a review screen is a stop in the middle of it. Turn it on when you want the person to approve the photo first.
- Done button: whether the final screen carries a Done button. On by default. Turn it off when your app closes the flow itself from
onResult(or fromonSubmiton a webhook delivery); the screen then stays until your app dismisses the SDK. A hosted page has no host app, so its redirect or close-this-tab note is unaffected. - Screen copy: your own title and description for the screens the person sees, on the workflow’s Presence Intelligence panel under Face check screens: the loading screen while the check runs (“Checking it’s you”) and, on a verdict delivered in the app, the verified screen (“You’re verified”) and the not-verified screen (“We couldn’t confirm it’s you”). Leave a field empty to keep the default;
{firstName}and{lastName}fill from theuserDatayou pass, as on the welcome and success screens. A not-verified description replaces the reason the server sends. Enrolment offers the loading screen only. In code the same block isbiometric.copy(waiting,verified,declined, each withtitleanddescription).
When the flow waits, the SDK fires a callback with the verdict:
onSubmit still fires the moment the check is submitted. onResult fires once when the wait settles, never when it times out, and carries the state and reason pair only; scores and other result data stay behind your secret key. Treat it as a courtesy to your UI: the webhook (where the flow sends one) and GET /api/v1/verifications/:id remain the record, and a decision your app enforces should rest on those, not on a value a client reported. HostedVerification accepts the same onResult for a minted re-authentication session opened on the hosted page.
Configure with a workflow
See Usage for the mount. The workflow’s configuration wins over any overlapping props, so the country, ID types, capture steps, branding, and copy all come from the dashboard. Only runtime data (userId, userData, metadata, and your callbacks) stays in code, because a workflow is a shared template and per-user values would leak between visitors.
A workflow is also the recommended way to turn on the extra capture steps: contact OTP (emailVerification / phoneVerification), proof of address (proofOfAddress), NFC chip (nfc), questionnaire, and business (KYB) verification (subjectType: 'business' + business), and to attach server-side decisioning. These are accepted as SDK props too, but configuring them on the workflow means you compose the checks once and change them by re-publishing, with no redeploy. See Workflows.
Customising the trigger button
<Verification /> renders a real <button>. In addition to the config props above it accepts standard button attributes (the props type is exported as VerificationProps), so you can treat it like any other button:
childrensets the label (falls back toVerify with {companyName}/Verify Identity).classNameis merged throughtailwind-merge, so your classes win over the defaults.styleis merged on top of the SDK’s injected theme variables, so theming still applies.onClickis owned by the SDK (it opens the modal) and can’t be overridden. For a fully custom trigger element, use theuseVerification()hook below.
Programmatic control
For a custom trigger instead of the built-in button, wrap your tree in VerificationProvider and drive the flow with the useVerification() hook:
The flow advances through VerificationStep values, reported via onStepChange / currentStep. The core path is consent → id-type → (id-input for number-only IDs, or document-capture) → liveness → submitted. Steps enabled by a workflow slot in automatically: email-verification / phone-verification (right after consent), country-select (multi-region), proof-of-address, questionnaire, and the KYB steps (business-details, business-key-people, business-documents, applicant-role).