enrollPasskey method

Future<MyAccountPasskeyAuthenticationMethod> enrollPasskey({
  1. required PasskeyEnrollmentChallenge challenge,
  2. required PasskeyCredential credential,
})

Enrolls a new passkey credential. This is the last part of the passkey enrollment flow.

Call this after enrollPasskeyChallenge and after creating the passkey in the browser. Pass the same challenge returned by enrollPasskeyChallenge, and the credential built with PasskeyCredential.fromMap from the new credential's toJSON() output.

Returns the enrolled MyAccountPasskeyAuthenticationMethod.

Requires an access token with the create:me:authentication_methods scope and audience https://{domain}/me/.

Usage example

final method = await myAccount.enrollPasskey(
  challenge: challenge,
  credential: credential,
);

Implementation

Future<MyAccountPasskeyAuthenticationMethod> enrollPasskey({
  required PasskeyEnrollmentChallenge challenge,
  required PasskeyCredential credential,
}) =>
    Auth0FlutterWebPlatform.instance
        .enrollPasskey(_accessToken, challenge, credential);