Learn how to implement multi-factor authentication (MFA) with Passkey using Passkey SDK.
.env
file.
tenant({ ... }).user(userId).mfa.registration.initialize()
and mfa.registration.finalize()
to create and store a passkey for your user which will be used as an MFA.
registerMfaPasskey()
function handles the passkey registration process. It first sends a request to the server to initiate the registration process and receives the response for creating a new passkey.
It then uses the @github/webauthn-json
library to create a new passkey credential based on the received options from the response. Finally, it sends another request to the server with the newly created credential to complete the registration process.
mfaRequired=true
is received from the login API, the user is redirected to an MFA page where passkey-based multi-factor authentication is performed.