ForgeRock Developer Experience

Handle web biometrics

The ForgeRock JavaScript SDK has the following methods for handling web biometrics:

FRWebAuthn.register(step, deviceName)

For registering new devices. Optionally, assign a name to the device to help the user identify it.

FRWebAuthn.authenticate(step)

For authenticating using a previously registered device.

Use the FRWebAuthn.getWebAuthnStepType() convenience method to determine which method to use:

// Determine if a step is a web biometrics step
const stepType = FRWebAuthn.getWebAuthnStepType(step);

if (stepType === WebAuthnStepType.Registration) {
  // Registering a new device, with optional device name
  step = await FRWebAuthn.register(step, 'myDeviceName');
} else if (stepType === WebAuthnStepType.Authentication) {
  // Authenticating with a registered device
  step = await FRWebAuthn.authenticate(step);
}

// `step` has now been populated with the web biometrics credentials

// Send this new step to the ForgeRock server
nextStep = FRAuth.next(step);
Copyright © 2010-2023 ForgeRock, all rights reserved.