@auth0/auth0-acul-js - v0.1.0-beta.5

    Interface MfaWebAuthnChangeKeyNicknameMembers

    MfaWebAuthnChangeKeyNicknameMembers

    Hierarchy

    • BaseMembers
      • MfaWebAuthnChangeKeyNicknameMembers

    Implemented by

    Index

    Properties

    Methods

    • Submits the new nickname for the WebAuthn security key. This action corresponds to the user entering a new nickname and clicking a "Save" or "Continue" button. The SDK will POST this new nickname to the Auth0 /u/mfa-webauthn-change-key-nickname endpoint.

      If the new nickname is valid and the update is successful, Auth0 will typically redirect the user to the next appropriate screen (e.g., back to MFA factor management or a success confirmation). If the nickname is invalid (e.g., empty, too long, too short), Auth0 will re-render the 'mfa-webauthn-change-key-nickname' screen, and the transaction.errors array in the SDK's context will be updated with details about the validation failure.

      Parameters

      Returns Promise<void>

      A promise that resolves when the form submission is initiated. It does not return data directly upon resolution, as a redirect or page re-render is the common outcome.

      Throws an error if payload.nickname is not provided or is not a string, or if the FormHandler encounters an unrecoverable issue during submission (e.g., network error). Validation errors from Auth0 (like an invalid nickname) are not thrown as JavaScript errors but are reflected in this.transaction.errors after the operation.

      // Assuming 'sdk' is an instance of MfaWebAuthnChangeKeyNickname
      const newNickname = "My Favorite YubiKey"; // Value from user input
      try {
      await sdk.continueWithNewNickname({ nickname: newNickname });
      // If successful, page redirects.
      } catch (error) {
      // This catch is for unexpected errors during the SDK call itself.
      console.error("Failed to submit the new nickname:", error);
      }
      // After the await, always check sdk.transaction.errors for server-side validation issues.
      if (sdk.transaction.errors && sdk.transaction.errors.length > 0) {
      sdk.transaction.errors.forEach(err => {
      if (err.field === 'nickname') {
      // Display err.message related to the nickname input field.
      // e.g., "Name is too short", "Name is required"
      }
      });
      }
    MMNEPVFCICPMFPCPTTAAATR