Skip to main content
MfaWebAuthnPlatformEnrollment
Example
// Assuming 'sdk' is an instance of MfaWebAuthnPlatformEnrollment
try {
  await sdk.submitPasskeyCredential(); // No need to pass publicKey explicitly
  // On success, Auth0 handles redirection.
} catch (error) {
  console.error('Passkey enrollment failed:', error);
  if (error.name && error.message) { // Check if it looks like a WebAuthn error
    await sdk.reportBrowserError({ error: { name: error.name, message: error.message } });
  }
}

Constructors

MfaWebAuthnPlatformEnrollment
Constructor
Initializes a new instance of the MfaWebAuthnPlatformEnrollment class.

Throws

If the Universal Login Context is not available or if the screen name in the context does not match MfaWebAuthnPlatformEnrollment.screenIdentifier.

Properties

branding
client
organization
prompt
screen
tenant
transaction
untrustedData
user
screenIdentifier
string
static

Methods

getErrors
Retrieves the array of transaction errors from the context, or an empty array if none exist.An array of error objects from the transaction context.
refuseEnrollmentOnThisDevice
Promise<void>
Allows the user to refuse WebAuthn platform enrollment on the current device.A promise that resolves upon successful submission of the refusal action.
reportBrowserError
Promise<void>
Reports a browser-side error encountered during the WebAuthn navigator.credentials.create() operation.A promise that resolves upon successful submission of the error report.

Throws

Throws an error if the form submission fails.
snoozeEnrollment
Promise<void>
Allows the user to choose to snooze the WebAuthn platform enrollment.A promise that resolves upon successful submission of the snooze action.
submitPasskeyCredential
Promise<void>
Initiates the WebAuthn platform credential creation process using the public key options available on this.screen.publicKey and submits the resulting credential to the server. This method internally calls createPasskeyCredentials (which wraps navigator.credentials.create()).A promise that resolves when the credential is successfully created and submitted.

Throws

Throws an error if this.screen.publicKey is not available, if createPasskeyCredentials fails (e.g., user cancellation, hardware issues), or if the submission to the server fails.
Example
// Assuming 'sdk' is an instance of MfaWebAuthnPlatformEnrollment
try {
  await sdk.submitPasskeyCredential(); // No need to pass publicKey explicitly
  // On success, Auth0 handles redirection.
} catch (error) {
  console.error('Passkey enrollment failed:', error);
  if (error.name && error.message) { // Check if it looks like a WebAuthn error
    await sdk.reportBrowserError({ error: { name: error.name, message: error.message } });
  }
}