Overview

15 Passwordless login: WebAuthn and hardware authentication

Passwordless authentication replaces fragile passwords with strong, device‑bound cryptography. Using WebAuthn, applications authenticate users with public‑key credentials backed by either biometrics (something you are) or hardware security keys (something you have). Because the private key never leaves the device and signatures are tied to the origin, this approach blocks common threats like phishing, credential stuffing, and brute force, while offering a faster, more user‑friendly login experience supported across modern browsers and operating systems.

Biometric authentication verifies identity from fingerprints, faces, irises, voices, or even palm vein patterns. During enrollment, devices store mathematical templates—not raw biometrics—in hardware‑backed secure areas such as TEEs or secure enclaves; subsequent logins match against these templates with a tolerance for variation. While biometrics are quick and convenient, they introduce distinct risks: template theft is irreversible, weak enrollment flows can be abused with deepfakes, and improperly protected data paths enable replay or MITM attacks. Presentation and spoofing attacks further threaten sensors without robust liveness checks. Strong implementations pair secure storage with encryption, anti‑replay measures, liveness detection, and clear user prompts to reduce social‑engineering success.

Hardware security keys implement FIDO2/WebAuthn with on‑device keypair generation, challenge‑response signing, and strict origin binding, making them highly resistant to phishing and secret exfiltration. Their main trade‑offs are operational: users may lose a key and services must support them, so backups and recovery processes matter. Implementing WebAuthn centers on two flows: registration (create credentials and store the public key and credential ID server‑side) and authentication (issue a random challenge, have the authenticator sign it, then verify with the stored public key). Production‑grade deployments require secure contexts (HTTPS or localhost), ephemeral challenge storage with timeouts, rpId/origin verification, horizontal scalability considerations, and reliance on well‑vetted libraries rather than custom cryptographic code.

A three-step process. Initially, a sure needs to register their data. Following registration, the user can try to authenticate and get verified by the system.
Improperly secured transmission and storage of biometric authentication data can expose it to hackers, who may then exploit it in replay attacks.
The authentication process using a hardware key. The app generates a random value and asks the key to sign it with its private key. The app then verifies the signature using its public key. The public key from the pair needs to already be configured at the app level. This configuration happens during the registration step.
Running a local web server using the jwebserver command from the JDK. The server is started in the bin directory of the JDK installation, binding to 127.0.0.1 on port 8000. This allows the HTML page to be served over a secure context (localhost), which is required for WebAuthn functionality.
When the "Register WebAuthn Credential" button is clicked, the browser initiates the WebAuthn registration process. The system prompts the user with a Windows Security dialog to confirm their identity and save a passkey for the specified domain (localhost in this case), using platform authentication.
Output in the browser’s developer console after triggering the WebAuthn registration process. The console displays the attestation object and client data in base64-encoded form, representing the public key credential generated by the browser.

Summary

  • Passwordless authentication improves security and convenience by eliminating weak or reused passwords.
  • Spoofing attacks (deepfakes, fake fingerprints) and stolen biometric templates pose risks, such as unauthorized access to sensitive accounts, bypassing multi-factor authentication, and long-term identity compromise
  • Storing biometric data in secure hardware (TPM, Secure Enclave) and implementing anti-spoofing measures improves security.
  • Hardware security keys provide the strongest authentication by using public-key cryptography.
  • Hardware security keys eliminate phishing risks but require physical possession, making backup keys necessary.
  • Using FIDO2/WebAuthn and enforcing domain binding ensures maximum security.
  • Passwordless authentication reduces phishing, credential leaks, and login friction.
  • No single method fits all use cases. Choosing the right approach depends on security needs, usability, and risk factors.
  • Proper implementation is key—even the most secure authentication method can be exploited if configured poorly.
  • Following best practices, encryption standards, and secure handling of authentication data ensures a stronger, safer login experience.

FAQ

What is WebAuthn and how does it enable passwordless login?WebAuthn is a W3C/FIDO standard that replaces passwords with public‑key cryptography. During registration, a device creates a key pair; the private key stays on the device and the public key is stored by the app. At login, the device proves possession of the private key by signing a server challenge. This eliminates reusable secrets and resists phishing, credential stuffing, and brute force.
How do biometrics differ from hardware security keys?Biometrics verify “something you are” (fingerprint, face, iris, voice) using a platform authenticator built into your device. Hardware security keys verify “something you have” (a physical FIDO2/WebAuthn key). Biometrics are convenient but can face spoofing risks if poorly implemented; hardware keys provide strong, phish‑resistant, device‑bound cryptography and are often considered the most robust option.
How is biometric data stored and protected?Devices don’t store raw fingerprints or faces. They derive a mathematical template and keep it in a hardware‑backed secure area (e.g., Secure Enclave, TEE, TPM). Matching is done locally; the template never leaves the device. Storing templates outside such hardware or transmitting them exposes users to permanent compromise.
What are common biometric authentication threats and how can I mitigate them?Threats include spoofing/presentation attacks (fake fingerprints, photos, 3D masks), replay or MITM if data is transmitted insecurely, and token/session theft after authentication. Mitigations: liveness detection, hardware‑backed storage, encrypted transport, anti‑replay with per‑use challenges, strong enrollment and identity verification, origin checks, and user education to avoid social‑engineering prompts.
How do hardware security keys work during login?They use challenge‑response. The server sends a random challenge; the key signs it with its private key; the server verifies the signature with the stored public key. The private key never leaves the device, so there’s nothing for attackers to reuse or exfiltrate.
How do hardware keys prevent phishing?Authenticators are bound to the site’s origin (rpId). A key registered for https://securebank.com will refuse to sign for https://fakebank.com, even if the page looks identical. This origin binding makes hardware keys effectively phish‑resistant.
What if I lose my hardware key or my biometric stops working (e.g., I shaved my beard)?Register at least one backup key and set up a recovery flow. If biometrics fail temporarily, use configured fallbacks (PIN, password, or another factor) and re‑enroll biometrics if needed. Without a backup or recovery, you can be locked out.
Why does WebAuthn require HTTPS or localhost?WebAuthn APIs only work in a secure context to protect origins and data in transit. HTTPS (or localhost during development) prevents eavesdropping and origin spoofing, which are critical to maintaining WebAuthn’s security guarantees.
What are the main steps of WebAuthn registration and what does the server store?Steps: the browser requests credential creation; the authenticator creates a key pair; the client returns data (public key, credential ID, client data, optional attestation) to the server. The server stores a mapping of user → credential ID, public key (and algorithm/metadata) for future signature verification.
What is the attestation object in WebAuthn, and do I need it?The attestation object is authenticator‑provided data (including authenticator info and an attestation statement) proving that a real device generated the key. Many consumer apps set attestation to “none” and don’t strictly verify it. Enterprises may validate attestation to enforce device policies or provenance.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Software Security for Developers ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Software Security for Developers ebook for free