Skip to main content
Use the OwnID Web SDK (window.ownid.headless) to start and complete the identity document challenge from your frontend. The access token from a prior email or phone verification step is required to scope the challenge to the authenticated user. The flow is:
  1. Start the challenge using the access token from the preceding email or phone verification step.
  2. Redirect the user to the hosted challenge URL returned by OwnID.
  3. After the user completes verification, OwnID redirects them back to your finish URL with a ownid_iddoc_challengeId query parameter.
  4. Call continue() on your finish page to resume the challenge and wait for the status to settle.
  5. Use the returned access token to log the user in and establish a session.
const { headless } = window.ownid;

// Start the identity document challenge
const challenge = await headless
  .withContext({ accessToken: 'access token from previous auth' })
  .verifications.iddoc.start({
    on: {
      finish: { url: '/finish.html' } // called with ?ownid_iddoc_challengeId=...
    }
  });

if ('error' in challenge) {
  // handle error
  return;
}

location.href = challenge.options.redirectUrl;

// On your finish page:
const resumed = headless.verification.iddoc.continue(); // reads challengeId from query string

const res = await resumed.whenStatusSettled;
if ('error' in res) {
  // handle error
  return;
}

const session = await headless.withContext({ accessToken: res.accessToken }).auth.login();

establishYourSession(session.sessionPayload);