Embed (Popup Drop-in)
Drop in @rebellion-systems/authensee-embed and launch the co-branded hosted flow in a popup for enrollment, authentication, and recovery.
Embed (Popup Drop-in)
@rebellion-systems/authensee-embed is a framework-agnostic drop-in that launches the AuthenSee hosted flow in a popup. You mint a session on your backend, call AuthenSee.open() to open the popup, and relay the one-time result back to your page from your callback URL.
The popup is the recommended surface. A popup is a top-level browsing context, which is the only place the WebAuthn passkey ceremony works across browsers — navigator.credentials.create() (passkey registration) and discoverable get() are blocked or restricted inside cross-origin iframes (Safari blocks them; Chrome only allows create() since v119 with a permission policy). Enrollment and recovery therefore require the popup.
Install
Or load the IIFE/CDN build, which exposes a global window.AuthenSee:
The package ships ESM, CJS, and IIFE builds.
How it works
Step 1: Mint a session and open the popup
Call open() inside a user gesture (a click handler) so the browser doesn't block the popup. Pass flowUrl as a function so the popup opens immediately and is navigated once your mint resolves — your backend creates the session and returns the hostedUrl from POST /v1/sessions.
Your backend creates the session with its secret key and passes the
callbackUrl (your callback page) so the popup knows where to land:
POST /v1/sessions returns a one-time flowCode and the ready-to-use
hostedUrl (https://auth.authensee.com/flow/{flowCode}). The flow code is
single-use — see the API reference for the full response.
Step 2: Relay the result from your callback page
On the page you registered as callbackUrl, call relayCallback(). It reads the one-time result from the URL, publishes it to the opener over a same-origin BroadcastChannel named "authensee", and closes the popup.
The result fields delivered to onComplete are:
| Field | Type | Description |
|---|---|---|
authResultCode | string | null | One-time auth result code — exchange it server-side with your secret key. null for enroll-only flows. |
linked | string | null | Present ("1") when an existing persona was linked rather than newly enrolled. |
providerSubject | string | null | AuthenSee's provider-scoped stable alias for the persona, when applicable. |
sessionId | string | The AuthenSee session ID this flow ran under. |
open() options
| Option | Type | Required | Description |
|---|---|---|---|
flowUrl | string | (() => string | Promise<string>) | Yes | The hosted-flow URL, or a function returning it (e.g. an async mint). A function is opened gesture-safely. |
onComplete | (result) => void | Yes | Called when the flow completes successfully. |
onError | (error) => void | No | Called on error or when the popup is blocked (code: "POPUP_BLOCKED"). |
features | string | No | Override the popup window features (size, chrome). |
open() returns a handle with close() and focus() methods.
Iframe mount (authentication-only)
mount(target, options) renders the flow inline in an iframe. It is authentication-only and only suitable for browsers that allow cross-origin publickey-credentials-get: a cross-origin iframe cannot run passkey registration (and discoverable get() is restricted), so it cannot do enrollment or recovery. Prefer open().
Branding
The hosted flow is co-branded from your provider configuration: AuthenSee owns the frame and you contribute a logo, display name, one brand color, one copy line, and a light or dark surface. See theming for the co-brand model.
Next steps
- Hosted pages guide — the redirect-based flow and the cookie-free hosted runtime
- Theming — the co-brand model and theme fields
- API reference —
POST /v1/sessions,GET /v1/sessions/current