Skip to main content
The MfaWebAuthnRoamingChallenge screen class provides methods associated with the mfa-webauthn-roaming-challenge screen.
MfaWebAuthnRoamingChallenge

Constructors

Create an instance of MfaWebAuthnRoamingChallenge screen
Example
import MfaWebAuthnRoamingChallenge from "@auth0/auth0-acul-js/mfa-webauthn-roaming-challenge";

const mfaWebAuthnRoamingChallengeManager = new MfaWebAuthnRoamingChallenge();

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-roaming-challenge 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.
reportWebAuthnError
(options ?)
This method reports a specific WebAuthn API error to Auth0. This method should be used if navigator.credentials.get() fails in a way that verify() doesn’t automatically handle, or if the developer wants to explicitly report an error before trying another action. It submits the error details with action: "showError::{errorDetails}". Returns a promise that resolves when the error report is submitted.
Example
import MfaWebAuthnRoamingChallenge from "@auth0/auth0-acul-js/mfa-webauthn-roaming-challenge";

const sdk = new MfaWebAuthnRoamingChallenge();

// And webAuthnError is an error object from a failed navigator.credentials.get() call.
try {
  await sdk.reportWebAuthnError({
    error: { name: webAuthnError.name, message: webAuthnError.message }
  });
} catch (submitError) {
  console.error("Failed to report WebAuthn error:", submitError);
}
options
OPTIONAL
Contains the error object (with name and message properties from the browser’s WebAuthn API DOMException) and any other custom options.
tryAnotherMethod
(options ?)
This method allows the user to opt-out of the WebAuthn challenge and select a different MFA method. This action submits action: "pick-authenticator" to Auth0, which should navigate the user to an MFA factor selection screen. Returns a promise that resolves when the action is submitted.
Example
import MfaWebAuthnRoamingChallenge from "@auth0/auth0-acul-js/mfa-webauthn-roaming-challenge";

const sdk = new MfaWebAuthnRoamingChallenge();

try {
  await sdk.tryAnotherMethod();
  // On success, Auth0 handles redirection to MFA selection.
} catch (error) {
  console.error("Failed to switch MFA method:", error);
}
options
OPTIONAL
Optional custom parameters to be sent with the request.
verify
(options ?)
This method initiates the WebAuthn challenge by calling navigator.credentials.get() with the options provided in screen.data.publicKeyChallengeOptions. If successful, it submits the resulting credential to Auth0 with action: "default". If navigator.credentials.get() fails with a known WebAuthn API error, for example: NotAllowedError, this method will internally call reportWebAuthnError to inform Auth0. Returns a promise that resolves when the verification attempt is submitted.
Example
import MfaWebAuthnRoamingChallenge from "@auth0/auth0-acul-js/mfa-webauthn-roaming-challenge";

const sdk = new MfaWebAuthnRoamingChallenge();

try {
  await sdk.verify({ rememberDevice: true });
  // On success, Auth0 handles redirection.
} catch (error) {
  console.error("Security key verification failed:", error);
  // Check sdk.transaction.errors for server-side validation messages if the page reloads.
}
options
OPTIONAL
Optional parameters for the verification. This can include rememberDevice if this.screen.showRememberDevice is true, and any other custom key-value pairs to be sent in the form submission.