passkeySignupChallenge method

Future<WebPasskeyChallenge> passkeySignupChallenge({
  1. String? email,
  2. String? phoneNumber,
  3. String? username,
  4. String? name,
  5. String? givenName,
  6. String? familyName,
  7. String? nickname,
  8. String? picture,
  9. String? connection,
  10. String? organizationId,
  11. Map<String, String>? userMetadata,
  12. DeliveryMethod? deliveryMethod,
})

Requests a WebAuthn registration challenge for signing up a new user with a passkey.

This is the first step of the passkey signup flow. Use the returned WebPasskeyChallenge.authParamsPublicKey with the browser's WebAuthn API (navigator.credentials.create()) to create a new passkey credential, then pass the resulting credential to getTokenByPasskey to exchange it for tokens.

Note: navigator.credentials.create() requires a user gesture, so call this from within a click handler (not, for example, from onLoad).

Notes

  • Identify the new user with any combination of email, phoneNumber, username, name, givenName, familyName, nickname, and picture, depending on how your connection is configured.
  • connection is the name of the database connection configured with passkeys.
  • organizationId is the optional Auth0 organization to sign up to.
  • userMetadata is optional metadata to associate with the new user.
  • deliveryMethod selects how a phone one-time code is delivered when the connection requires phone identifier verification. It is ignored when only an email is verified. Defaults to the connection's setting.

Identifier verification

When identifier verification is enabled for the connection, WebPasskeyChallenge.verificationRequired lists the identifiers to verify. Collect a one-time code for each of them before calling navigator.credentials.create(), then pass the codes as verification to getTokenByPasskey.

Implementation

Future<WebPasskeyChallenge> passkeySignupChallenge({
  final String? email,
  final String? phoneNumber,
  final String? username,
  final String? name,
  final String? givenName,
  final String? familyName,
  final String? nickname,
  final String? picture,
  final String? connection,
  final String? organizationId,
  final Map<String, String>? userMetadata,
  final DeliveryMethod? deliveryMethod,
}) =>
    Auth0FlutterWebPlatform.instance.passkeySignupChallenge(
      WebPasskeySignupChallengeOptions(
        email: email,
        phoneNumber: phoneNumber,
        username: username,
        name: name,
        givenName: givenName,
        familyName: familyName,
        nickname: nickname,
        picture: picture,
        connection: connection,
        organization: organizationId,
        userMetadata: userMetadata,
        deliveryMethod: deliveryMethod,
      ),
    );