Initializes a new instance of the MfaWebAuthnPlatformEnrollment
class.
Static
screenstatic
Allows the user to refuse WebAuthn platform enrollment on the current device.
Optional
payload: Classes.CustomOptionsOptional custom parameters to be sent with the request.
A promise that resolves upon successful submission of the refusal action.
Reports a browser-side error encountered during the WebAuthn navigator.credentials.create()
operation.
An object containing the error
(with name
and message
properties
from the browser's WebAuthn API error) and any other custom options.
A promise that resolves upon successful submission of the error report.
Allows the user to choose to snooze the WebAuthn platform enrollment.
Optional
payload: Classes.CustomOptionsOptional custom parameters to be sent with the request.
A promise that resolves upon successful submission of the snooze action.
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()
).
Optional
payload: Classes.SubmitPasskeyCredentialOptionsOptional custom parameters to be sent to the server along with the created credential.
A promise that resolves when the credential is successfully created and submitted.
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.
// 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 } });
}
}
MfaWebAuthnPlatformEnrollment