Skip to main content
init() configures the SDK. Call it once when your app starts, before vycheck() or vyget(). This is also where you choose how the verification flow appears to the user.
npm install @verifyyou-sdk/client
import { init } from "@verifyyou-sdk/client";

init({ publishableKey: "pk_test_…" });
That is the whole setup for the default redirect flow. The publishable key is safe to ship in the browser.

Three ways to show the flow

The browser navigates to the hosted flow and returns to your page with the result on the URL.
init({ publishableKey: "pk_test_…" });
In the iframe modes the result is delivered to your onComplete callback and to the promise returned by vycheck(). There is no redirect, so nothing is appended to your URL.

Options

publishableKey
string
required
Your publishable key (pk_test_… or pk_live_…). Use the test key while you build and swap in the live key when you ship. Keys come in matched pairs: a session started with a test key can only be confirmed with the test secret key on your backend, and the same goes for live.
mode
"redirect" | "iframe"
default:"redirect"
How the flow runs. redirect navigates to the hosted flow and back. iframe embeds it in your page instead.
display
"drawer" | "inline"
default:"drawer"
Iframe modes only. drawer overlays the page. inline mounts into container.
container
HTMLElement | string
Target for inline display: an element or a CSS selector. Required when display is inline.
inlineHeight
string
default:"fill"
Inline height behavior. fill fills the container, auto grows with the flow’s content, or pass a CSS length like 640px.
email
string
Prefill the login step with an email. This is a UI convenience only. To bind an identity the user cannot change, initialize server-side with your secret key.
phone
string
Prefill the login step with a phone number. Same rules as email.
onComplete
(result: VyResult) => void
Iframe modes only. Fires with the result when the flow finishes. The same result also resolves the vycheck() promise and is returned by vyget().
onClose
() => void
Iframe modes only. Fires when the user dismisses the flow without finishing.
connectBase
string
Advanced. Override the API origin the SDK talks to. Defaults to production (https://trust.verifyyou.com). You only need this for a non-production environment.

Where the user returns

In redirect mode the return destination is the redirect URL saved on your verification in the dashboard. Set it there before you go live. If the verification has no saved redirect URL, the SDK falls back to the page origin that started the flow.
Whichever display mode you pick, the result still has to be confirmed on your backend with your secret key. The client-side verdict is a UI hint, nothing more.