Skip to main content
The MfaWebAuthnPlatformEnrollment screen class provides methods associated with the mfa-webauthn-platform-enrollment screen.
MfaWebAuthnPlatformEnrollment

Constructors

Create an instance of MfaWebAuthnPlatformEnrollment screen
Example
import MfaWebAuthnPlatformEnrollment from "@auth0/auth0-acul-js/mfa-webauthn-platform-enrollment";
const sdk = new 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 } });
  }
}

Properties

branding
Provides branding-related configurations, such as branding theme and settings.
client
Provides client-related configurations, such as id, name, and logoUrl.
organization
Provides information about the user’s organization, such as organization id and name.
prompt
Contains data about the current prompt in the authentication flow.
screen
Contains details specific to the mfa-webauthn-platform-enrollment screen, including its configuration and context.
tenant
Contains data related to the tenant, such as id and associated metadata.
transaction
Provides transaction-specific data, such as active identifiers and flow states.
untrustedData
Handles untrusted data passed to the SDK, such as user input during login.
user
Details of the active user, including username, email, and roles.

Methods

getErrors
This method retrieves the array of transaction errors from the context, or an empty array if none exist.
refuseEnrollmentOnThisDevice
(options ?)
This method allows the user to refuse WebAuthn platform enrollment on the current device. Returns a promise that resolves upon successful submission of the refusal action.
Example
import MfaWebAuthnPlatformEnrollment from "@auth0/auth0-acul-js/mfa-webauthn-platform-enrollment";
const sdk = new MfaWebAuthnPlatformEnrollment();

sdk.refuseEnrollmentOnThisDevice();
options
OPTIONAL
Optional custom parameters to be sent with the request.
reportBrowserError
(options ?)
This method reports a browser-side error encountered during the WebAuthn navigator.credentials.create() operation. Returns a promise that resolves upon successful submission of the error report.
Example
import MfaWebAuthnPlatformEnrollment from "@auth0/auth0-acul-js/mfa-webauthn-platform-enrollment";
const sdk = new MfaWebAuthnPlatformEnrollment();

await sdk.reportBrowserError( {
  error: 'message'
});
options
OPTIONAL
Contains the error object (with name and message properties from the browser’s WebAuthn API DOMException) and any other custom options.
snoozeEnrollment
(options ?)
This method allows the user to choose to snooze the WebAuthn platform enrollment. Returns a promise that resolves upon successful submission of the snooze action.
Example
import MfaWebAuthnPlatformEnrollment from "@auth0/auth0-acul-js/mfa-webauthn-platform-enrollment";
const sdk = new MfaWebAuthnPlatformEnrollment();

await sdk.snoozeEnrollment();
options
OPTIONAL
Optional custom parameters to be sent with the request.
submitPasskeyCredential
(options ?)
This method 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. Returns a promise that resolves when the credential is successfully created and submitted.
Example
import MfaWebAuthnPlatformEnrollment from "@auth0/auth0-acul-js/mfa-webauthn-platform-enrollment";
const sdk = new 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 } });
  }
}
options
OPTIONAL
Optional custom parameters to be sent to the server along with the created credential.