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.
Three ways to show the flow
- Redirect (default)
- Drawer
- Inline
The browser navigates to the hosted flow and returns to your page with the result on the URL.
onComplete callback and to the promise returned by vycheck(). There is no redirect, so nothing is appended to your URL.
Options
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."redirect" | "iframe"
default:"redirect"
How the flow runs.
redirect navigates to the hosted flow and back.
iframe embeds it in your page instead."drawer" | "inline"
default:"drawer"
Iframe modes only.
drawer overlays the page. inline mounts into
container.HTMLElement | string
Target for inline display: an element or a CSS selector. Required when
display is inline.string
default:"fill"
Inline height behavior.
fill fills the container, auto grows with the
flow’s content, or pass a CSS length like 640px.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.
string
Prefill the login step with a phone number. Same rules as
email.(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().() => void
Iframe modes only. Fires when the user dismisses the flow without finishing.
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.