register

abstract suspend fun register(parameters: BiometricsParameters): BiometricsRegisterResponse

Registers the device's biometric credential (fingerprint, face, etc.) for the current user. Performs a two-step flow: calls POST /sdk/v1/biometrics/register/start to get a challenge, prompts the user for biometric authentication, then calls POST /sdk/v1/biometrics/register to complete registration. Requires an active session.

Kotlin (Android):

StytchConsumer.biometrics.register(
BiometricsParameters(
context = activity,
sessionDurationMinutes = 30,
)
)

iOS:

let params = BiometricsParameters(sessionDurationMinutes: 30)
let response = try await StytchConsumer.biometrics.register(params)

React Native:

StytchConsumer.biometrics.register({ sessionDurationMinutes: 30 })

Return

BiometricsRegisterResponse containing the updated session and user.

Parameters

parameters
  • BiometricsParameters

  • sessionDurationMinutes — Duration of the session after successful registration, in minutes.

  • (Android only) context — The FragmentActivity used to display the biometric prompt.

  • (Android only) allowDeviceCredentials — Whether to allow PIN/pattern/password as a fallback.

  • (Android only) promptData — Custom title, subtitle, and description for the biometric prompt.

  • (Android only) allowFallbackToCleartext — Whether to store the key in cleartext if the secure enclave is unavailable.

  • (iOS only) promptData — Custom reason string shown in the Face ID / Touch ID prompt.

Throws

if a biometric registration already exists on this device.

if no active session is present.

BiometricsUnsupportedError

if the device does not support biometrics.

StytchError

if registration fails.

if the coroutine is cancelled.