
Passwords have been the standard method of securing online accounts for many years. However, they create several security and usability problems. Users frequently reuse passwords, choose weak combinations or fall victim to phishing websites that imitate legitimate login pages.
WebAuthn and passkeys provide an alternative authentication approach that allows users to sign in using cryptographic credentials instead of entering a traditional password.
Modern browsers and devices support passwordless authentication through technologies such as biometrics, device PINs and security keys. Users can verify their identity using familiar methods while cryptographic operations take place behind the scenes.
WebAuthn is particularly useful for applications that want to improve account security, reduce password-related attacks and simplify the login experience.
This article explains WebAuthn, passkeys, FIDO2, public-key cryptography, authentication workflows, implementation concepts, security considerations, applications and practical projects.
Web Authentication, commonly known as WebAuthn, is a web standard that allows websites to authenticate users using public-key cryptography.
It is part of the FIDO2 authentication ecosystem and is supported by modern browsers and compatible devices.
Instead of sending a password to the server, WebAuthn uses a public-private key pair.
During registration:
The user's device generates a cryptographic key pair.
The private key remains protected by the authenticator.
The public key is sent to the website.
The server stores the public key with the user's account.
During login, the server sends a challenge to the user's device. The authenticator uses the private key to sign the challenge, and the server verifies the signature using the stored public key.
The private key is not sent to the website during authentication.
Public-key authentication: It uses cryptographic key pairs rather than shared passwords.
Origin binding: Credentials are associated with a relying party and its permitted web origin, helping protect against phishing websites.
User verification: Depending on the authenticator and configuration, users can verify themselves using a device PIN, fingerprint or facial recognition.
Hardware and platform support: Authentication can use built-in device authenticators or external security keys.
Passwordless login: Applications can use WebAuthn credentials as the primary sign-in method.
Challenge-response authentication: The server verifies signed challenges instead of receiving a reusable password.
Passkeys are passwordless sign-in credentials built using public-key cryptography and FIDO authentication standards.
They provide a user-friendly way to use WebAuthn without requiring people to understand cryptographic keys.
A passkey is generally stored in a password manager, operating-system credential system or compatible authenticator.
When a user signs in, the device or credential provider helps select the correct passkey and completes the cryptographic authentication process.
Users may unlock their passkeys using:
Fingerprint recognition.
Facial recognition.
Device PIN.
Device password.
Another supported local verification method.
The biometric information normally stays within the device's authentication system. The website receives the result of the cryptographic authentication process, not the user's fingerprint or face data.
Passkeys can be broadly understood through their storage and synchronisation behaviour.
Synced passkeys: These can be synchronised across supported devices through a credential provider or password manager. This makes them convenient when users switch devices.
Device-bound passkeys: These remain associated with a particular device or authenticator and are not automatically synchronised in the same way.
Both approaches use public-key cryptography. Their recovery, availability and device-management characteristics differ.
FIDO2 is an authentication framework designed to reduce dependence on passwords.
It combines two important technologies:
WebAuthn
CTAP (Client to Authenticator Protocol)
WebAuthn provides the browser-facing interface through which websites register and authenticate public-key credentials.
It allows a website to communicate with the browser and request an authentication operation.
CTAP enables communication between a client device and an external authenticator.
For example, a user may connect a USB security key or use another compatible authenticator to complete authentication.
CTAP supports interactions that allow an external authenticator to participate in FIDO authentication.
WebAuthn handles communication between the website and browser.
CTAP supports communication between the client and an external authenticator when required.
Together, they provide a standardised authentication architecture for websites and compatible devices.
WebAuthn has two main operations:
Registration, also known as credential creation.
Authentication, also known as assertion or sign-in.
Both operations use challenges generated by the server.
Registration creates a new public-key credential for a user account.
The user opens the account security settings and selects an option such as "Create a passkey".
The frontend sends a request to the backend asking for registration options.
The server generates a cryptographically random challenge.
It also provides information such as:
User ID.
Username.
Display name.
Relying party ID.
Allowed public-key algorithms.
Authenticator preferences.
Credential-selection requirements.
The challenge must be unpredictable and should be stored temporarily on the server.
The browser uses the WebAuthn API:
const credential = await navigator.credentials.create({
publicKey: registrationOptions
});
The browser communicates with an appropriate authenticator.
The authenticator may request a fingerprint, facial recognition, device PIN or another supported verification method.
The exact process depends on the device and authenticator.
The authenticator generates a public-private key pair for the relying party.
The private key remains protected by the authenticator or credential provider.
The browser receives a credential creation result containing the public-key credential information.
The browser sends the registration response to the backend.
The server verifies important information, including:
The original challenge.
The expected origin.
The relying party ID hash.
The credential type.
The attestation information, when applicable.
The registration response structure.
After successful verification, the server stores the public key and associated credential information.
The user can then use the credential to sign in.
Authentication verifies that the user possesses the private key associated with a previously registered credential.
The user selects a passkey login option on the website.
The browser requests authentication options from the server.
The backend generates a fresh, random challenge.
It also supplies the relying party ID and other authentication requirements.
If the account is already known, the server may provide the user's registered credential IDs.
The frontend calls:
const assertion = await navigator.credentials.get({
publicKey: authenticationOptions
});
The browser locates an eligible credential and requests user verification when required by the configuration.
After the user completes the required verification, the authenticator uses the private key to sign the authentication data.
The private key is not transmitted to the website.
The browser sends the authentication assertion to the backend.
The response contains information such as:
Credential ID.
Authenticator data.
Client data.
Signature.
User handle, when available.
The backend verifies the response using the public key stored during registration.
It checks the challenge, origin, relying party ID hash, signature and relevant authenticator flags.
If verification succeeds, the application can establish an authenticated session.
A WebAuthn implementation involves multiple components that work together.
The relying party is the website or application that requests authentication.
For example, an online shopping platform can act as a relying party when it registers and authenticates user passkeys.
The relying party maintains the user's account information and registered public-key credentials.
The user agent is generally the web browser.
It provides the WebAuthn JavaScript API and communicates with the authenticator.
It also helps enforce security requirements involving the website origin.
An authenticator creates and uses cryptographic credentials.
Examples include:
Built-in device authenticators.
External USB security keys.
NFC-compatible security keys.
Other supported platform or roaming authenticators.
A credential represents the public-key identity registered for a particular relying party.
It includes a credential ID and associated public-key information.
The server stores the public key and other metadata needed for verification.
A challenge is a random value generated by the server for an authentication operation.
It helps prevent replay attacks because an old authentication response should not be accepted for a new challenge.
The relying party ID, commonly called rpId, identifies the website domain associated with a WebAuthn credential.
For example, an application hosted under login.example.com may use an appropriately configured relying party ID such as example.com.
The browser enforces the relationship between the requesting origin and the relying party ID.
Public-key cryptography is the foundation of WebAuthn.
It uses two mathematically related keys:
Private key: Used by the authenticator to sign authentication data. It should remain protected and should not be shared with the website.
Public key: Stored by the server and used to verify signatures created by the corresponding private key.
Imagine that a user registers a passkey with an application.
The application stores the public key, while the private key remains protected by the user's authenticator.
Later, the application generates a new challenge.
The authenticator signs the relevant authentication data with its private key.
The server verifies the signature using the stored public key.
If the signature and other verification checks are valid, the application accepts the authentication response.
This approach avoids sending a reusable password to the server.
Challenge-response authentication uses a fresh server-generated value to verify possession of a cryptographic credential.
The server should generate unpredictable challenges and ensure that each challenge is used only for its intended authentication ceremony.
User verification confirms that the person interacting with the authenticator has completed an approved local verification method.
Examples include biometric verification or a device PIN.
User verification requirements can be configured according to the application's security needs.
User presence indicates that the user has interacted with the authenticator.
It is different from user verification. A security key may confirm user presence through a physical touch without necessarily performing biometric verification.
Discoverable credentials, historically called resident credentials, allow an authenticator to identify suitable credentials without the website first supplying a specific credential ID.
This capability is important for usernameless passkey sign-in experiences.
Attestation is an optional mechanism that can provide information about the authenticator used during registration.
It may help an organisation enforce authenticator requirements in specialised environments.
Many consumer applications do not need to collect detailed authenticator attestation information.
Some passkeys can be backed up and synchronised across supported devices.
WebAuthn provides authenticator data and flags that can help a relying party understand backup eligibility and backup state.
Applications should consider these properties when designing account recovery and device-management workflows.
Traditional password authentication relies on a secret that the user remembers and submits to the website.
WebAuthn relies on a cryptographic credential stored in an authenticator.
The differences include:
Credential storage: Password systems generally store password verifiers on the server. WebAuthn stores a public key on the server while the private key remains protected by the authenticator.
Phishing resistance: Passwords can be entered into fake login pages. WebAuthn credentials are associated with the legitimate relying party, making ordinary phishing websites unable to use the credential for a different origin.
User experience: Password authentication requires users to remember and enter a password. Passkeys allow sign-in through a supported device verification method.
Replay protection: WebAuthn uses fresh challenges and signature verification to prevent reuse of old authentication responses.
Account recovery: Password systems can offer password-reset workflows. Passkey-based systems need appropriate recovery mechanisms, alternative credentials or supported credential synchronisation.
One-Time Password authentication uses temporary codes generated by an authenticator application, delivered through a supported communication channel or produced by a hardware token.
WebAuthn and OTP solve different authentication problems.
OTP codes are usually entered manually and can still be intercepted through phishing or social engineering.
WebAuthn binds authentication to the relying party's origin and uses cryptographic signatures.
WebAuthn is generally more resistant to conventional phishing attacks than manually entered OTP codes.
However, an application should still protect account recovery, session management and other authentication paths.
A WebAuthn implementation requires both frontend and backend components.
The browser handles credential creation and authentication requests, while the server generates challenges, verifies responses and stores credential information.
Choose a backend framework such as Node.js with Express.
A production implementation should use a maintained WebAuthn server library rather than implementing the cryptographic verification process manually.
One commonly used option is SimpleWebAuthn.
Install the required packages:
npm install express @simplewebauthn/server @simplewebauthn/browser
The server generates registration options for the current user.
A simplified conceptual example:
const {
generateRegistrationOptions
} = require("@simplewebauthn/server");
async function createRegistrationOptions(user) {
const options = await generateRegistrationOptions({
rpName: "Example Application",
rpID: "localhost",
userName: user.email,
userDisplayName: user.name,
attestationType: "none",
authenticatorSelection: {
residentKey: "preferred",
userVerification: "preferred"
}
});
// Save the challenge in temporary server-side
// session storage associated with this user.
return options;
}
The example demonstrates the registration-options concept. A real application must also provide a stable user ID, handle previously registered credentials, store the challenge securely and configure the correct relying party ID.
The frontend receives the options from the backend and requests credential creation.
Using the SimpleWebAuthn browser package:
import {
startRegistration
} from "@simplewebauthn/browser";
async function registerPasskey() {
const optionsResponse = await fetch(
"/api/webauthn/register/options",
{
method: "POST",
credentials: "include"
}
);
if (!optionsResponse.ok) {
throw new Error("Could not generate registration options");
}
const options = await optionsResponse.json();
const registrationResponse =
await startRegistration({ optionsJSON: options });
const verificationResponse = await fetch(
"/api/webauthn/register/verify",
{
method: "POST",
credentials: "include",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(registrationResponse)
}
);
if (!verificationResponse.ok) {
throw new Error("Passkey registration failed");
}
return verificationResponse.json();
}
The browser package handles the browser-side WebAuthn interaction and response preparation.
The backend receives the registration response.
It should use the server library's verification functionality to validate the response against:
The original challenge.
Expected origin.
Expected relying party ID.
User verification requirements.
Registration response details.
After successful verification, the application stores the credential ID, public key, signature counter and relevant credential metadata.
Do not store the private key.
When the user returns to sign in, the server generates a fresh authentication challenge.
For example:
const {
generateAuthenticationOptions
} = require("@simplewebauthn/server");
async function createLoginOptions(user) {
const options = await generateAuthenticationOptions({
rpID: "localhost",
userVerification: "preferred",
allowCredentials: user.credentials.map((credential) => ({
id: credential.credentialID,
transports: credential.transports
}))
});
// Store the challenge in the user's temporary
// authentication session.
return options;
}
For a username-first login, the server can use the registered credentials associated with that account.
For a usernameless passkey experience, the application can use discoverable credentials and handle account identification after receiving the authentication response.
The browser requests authentication using the options returned by the backend.
import {
startAuthentication
} from "@simplewebauthn/browser";
async function loginWithPasskey() {
const optionsResponse = await fetch(
"/api/webauthn/login/options",
{
method: "POST",
credentials: "include"
}
);
if (!optionsResponse.ok) {
throw new Error("Could not generate login options");
}
const options = await optionsResponse.json();
const authenticationResponse =
await startAuthentication({ optionsJSON: options });
const verificationResponse = await fetch(
"/api/webauthn/login/verify",
{
method: "POST",
credentials: "include",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(authenticationResponse)
}
);
if (!verificationResponse.ok) {
throw new Error("Passkey authentication failed");
}
return verificationResponse.json();
}
The server verifies the assertion using the stored public key and original challenge.
After successful verification, it should create a secure application session.
The session should be protected using appropriate cookie settings, such as:
HttpOnly
Secure
An appropriate SameSite value
A suitable expiration period
The application should also maintain normal session invalidation and logout mechanisms.
WebAuthn provides strong authentication capabilities, but implementation mistakes can undermine its security.
The server must verify that the received response contains the expected challenge.
Challenges should be generated using a cryptographically secure random generator and should expire after a short period.
The server must check that the client data contains an expected origin.
This prevents an authentication response generated for an unauthorised website from being accepted.
The server must verify the relying party ID hash contained in authenticator data.
A mismatch should cause verification to fail.
The website should never request or store the user's private key.
The authenticator performs the signing operation internally.
WebAuthn requires a secure context in normal production deployments. Localhost is treated as a trustworthy development origin by browsers.
Production applications should use HTTPS.
Successful WebAuthn verification should result in a properly protected application session.
Use secure cookies, appropriate session expiration and session invalidation procedures.
Only authenticated and authorised users should be allowed to register additional credentials for an account.
Consider requiring recent authentication or additional verification before allowing a new passkey to be added.
Users can lose devices or access to credential providers.
Provide carefully designed recovery options, such as alternative registered passkeys, verified recovery procedures or other appropriate authentication methods.
Recovery must not become an easier route for attackers to take over accounts.
Authenticators may provide signature-counter information.
Applications can use counter changes as one possible signal when assessing authenticator behaviour, but counter support and behaviour vary. A counter that does not increase should not automatically be treated as proof of an attack.
Authentication endpoints should avoid exposing unnecessary information about whether a particular account exists or has registered credentials.
Use appropriate response design, rate limiting and monitoring.
Receiving a credential from the browser does not mean registration is successful.
The server must verify the registration response before saving the public key.
A challenge should not be reused across unrelated registration or authentication operations.
Every authentication operation should use a fresh server-generated challenge.
Incorrect origin configuration can cause legitimate authentication to fail or weaken security validation.
Use the exact expected origins for the application environment.
Applications should maintain credential IDs, public keys, transports where available, user associations and other relevant metadata.
Users should be able to review and remove credentials they no longer use.
A website does not normally receive the user's fingerprint or facial data through WebAuthn.
The authenticator performs local verification and provides the cryptographic result.
A passwordless application without a reliable recovery strategy can lock legitimate users out of their accounts.
Recovery procedures should be secure, tested and documented.
WebAuthn verification involves several structured checks and cryptographic operations.
Use a maintained implementation library and follow its current documentation instead of creating custom signature-verification code without specialised expertise.
WebAuthn credentials are associated with a relying party and its permitted origin.
A fake website generally cannot use a credential created for the legitimate website.
Users do not need to create, remember or repeatedly enter a traditional password when the application supports passkey-based sign-in.
The server verifies signatures created using a registered private key.
Users can sign in through familiar device authentication methods instead of typing long passwords.
The application stores public keys instead of reusable password secrets for WebAuthn authentication.
Other sensitive account data and session credentials still require protection.
Synced passkeys can make credentials available across supported devices through compatible credential providers.
Passkeys are not manually reused across websites in the same way that passwords commonly are.
WebAuthn is widely supported, but exact authenticator features can differ across browsers, operating systems and devices.
Losing access to a device or credential provider may create recovery challenges.
Existing applications may need to update their registration, login, recovery and account-management workflows.
Some users may not understand the difference between a device PIN, biometric verification and a website password.
Clear instructions can help reduce confusion.
Some login flows involve a second device, QR codes or proximity checks. These experiences depend on platform and browser support.
WebAuthn requires careful server-side verification, challenge management, credential storage and session handling.
If recovery depends only on weak email or SMS verification, attackers may bypass the benefits of strong passkey authentication.
Financial applications can use passkeys to strengthen login security and reduce reliance on passwords.
Additional transaction verification may still be required depending on the risk and regulatory environment.
Shopping platforms can offer passkey login for customers who want a faster way to access accounts, orders and saved preferences.
Business applications can use WebAuthn to protect administrative dashboards, employee accounts and sensitive organisational information.
Organisations can integrate compatible security keys and platform authenticators into employee authentication systems.
Healthcare platforms can use passkeys as part of secure account-access systems, alongside appropriate identity verification and privacy controls.
Learning platforms can offer passwordless authentication for students, educators and administrators.
Code hosting and developer tools can use passkeys to protect accounts that have access to source code, deployment environments and technical infrastructure.
Build a basic login system using Node.js, Express, MongoDB and a WebAuthn library.
Allow users to register a passkey and authenticate without entering a password.
Create an account-security dashboard where users can register multiple credentials, view their names and remove unused passkeys.
Integrate WebAuthn into a React and Node.js application.
Store credential information in MongoDB and create secure sessions after successful verification.
Build an internal login portal that supports security keys and platform authenticators.
Include user roles and an administrative credential-management feature.
Create a learning interface that displays registration and authentication stages.
Show the challenge, credential ID, public-key information and verification status without exposing private keys.
JavaScript: Understand promises, asynchronous functions, browser APIs and JSON communication.
HTML and frontend development: Learn how to create registration, login and credential-management interfaces.
Backend development: Understand API endpoints, authentication routes, session management and request validation.
Cryptography fundamentals: Learn public-key cryptography, digital signatures, challenges and verification.
Database management: Understand how to store credential IDs, public keys and account associations.
Web security: Study HTTPS, origin validation, phishing resistance, secure cookies and account recovery.
Browser APIs: Learn navigator.credentials.create() and navigator.credentials.get().
Authentication architecture: Understand identity verification, user sessions, multi-factor authentication and credential lifecycle management.
WebAuthn is a specialised skill that can strengthen knowledge required in several technical roles.
Application security engineers evaluate authentication systems and help organisations implement secure login mechanisms.
Backend developers implement registration endpoints, challenge management, credential verification and session creation.
Full stack developers integrate passkey registration and authentication into frontend and backend applications.
These engineers work on authentication, authorisation, identity verification and enterprise access systems.
Cybersecurity engineers work on authentication security, credential protection and resistance to phishing attacks.
Security architects design authentication systems and determine how passkeys fit into broader identity and access-management strategies.
Follow this learning path:
Learn JavaScript and browser APIs.
Understand HTTP requests, responses and secure contexts.
Study authentication and session management.
Learn public-key cryptography and digital signatures.
Understand the FIDO2 framework.
Study the WebAuthn registration process.
Practise the authentication assertion process.
Explore a maintained WebAuthn server library.
Build a passwordless login application.
Add credential management and secure recovery features.
Start with a localhost project and test it using a compatible browser and authenticator before deploying it to a production domain.
Developers interested in authentication and secure web development can explore:
Online Courses – Explore technology and programming learning resources.
Course Search – Find relevant software-development and security learning opportunities.
Web Development – Explore frontend, backend and web application development topics.
WebAuthn and passkeys are changing how users authenticate themselves on websites. By using public-key cryptography, they reduce dependence on traditional passwords and provide stronger protection against common phishing attacks.
WebAuthn handles the technical authentication process, while passkeys provide a convenient credential experience through supported devices and credential providers.
Successful implementation requires more than adding a login button. Developers must correctly manage challenges, verify origins, protect credential information, establish secure sessions and provide reliable account-recovery options.
For frontend developers, backend engineers and cybersecurity professionals, learning WebAuthn provides valuable knowledge of modern identity and authentication systems.
WebAuthn is a web standard that allows websites to authenticate users using public-key cryptography instead of relying only on passwords.
A passkey is a passwordless authentication credential based on public-key cryptography. It allows users to sign in using a supported device, security key or credential provider.
WebAuthn is the standard and browser API used for public-key authentication. Passkeys are user-friendly credentials built using this technology and related FIDO standards.
FIDO2 is an authentication framework that combines WebAuthn and CTAP. It supports passwordless and phishing-resistant authentication through compatible browsers and authenticators.
No. WebAuthn can support passwordless authentication. Applications may also use it alongside passwords or other authentication methods.
WebAuthn credentials are associated with a relying party and its permitted origin. A fake website on a different origin generally cannot obtain a valid authentication response using the legitimate website's credential.
WebAuthn provides strong cryptographic authentication and phishing resistance when correctly implemented. Security also depends on challenge validation, origin checks, session management and account recovery.
No. The website does not normally receive fingerprint or facial-recognition data. The authenticator performs local user verification and returns a cryptographic authentication result.
A relying party is the website or application requesting authentication. It manages user accounts, generates challenges and verifies authentication responses.
An authenticator is a device or credential provider that creates and uses cryptographic credentials. Examples include built-in platform authenticators and external security keys.
A challenge is a fresh, unpredictable value generated by the server. It helps prevent replay attacks by ensuring that an authentication response is tied to a specific operation.
User presence indicates that the user interacted with the authenticator. User verification confirms that the authenticator performed a supported verification method, such as a PIN or biometric check.
Discoverable credentials are credentials that an authenticator can identify without the website first providing a specific credential ID. They help support usernameless passkey login.
Synced passkeys can be made available across supported devices through a credential provider. Device-bound passkeys remain associated with a particular authenticator or device and are not synchronised in the same way.
Yes. React can use the browser's WebAuthn functionality or a browser-side library, while Node.js can generate authentication options and verify registration and authentication responses.
WebAuthn normally requires a secure browser context. HTTPS is required for production websites, while localhost is treated as a trustworthy development origin by modern browsers.
Yes. Applications can allow users to register multiple credentials, such as a phone passkey, computer passkey or external security key.
The user may still be able to access the account through another registered passkey or a supported credential-synchronisation provider. Applications should also provide secure account-recovery procedures.
No. WebAuthn is an authentication standard. Depending on its configuration, it can provide passwordless authentication or be used as an additional authentication factor. Its user-verification and credential properties determine the security characteristics of a particular flow.
JavaScript is useful for browser integration. Backend implementations can use supported libraries in environments such as Node.js, Python, Java and other server-side platforms.
CTAP stands for Client to Authenticator Protocol. It enables communication between a client device and an external authenticator, such as a compatible security key.
Yes, applications can adopt passwordless authentication using passkeys. However, they must also design secure recovery, credential replacement and account-management processes before removing password-based login.
A server typically stores the credential ID, public key, associated user account, signature-counter information and relevant credential metadata. It does not store the authenticator's private key.
A passwordless login application using React, Node.js and MongoDB is a useful starting project. It demonstrates registration, authentication, credential storage and session management.
Yes. Enterprises can use WebAuthn with compatible platform authenticators and security keys to strengthen employee authentication and reduce dependence on passwords.
More News Click here
Discover thousands of colleges and courses, enhance skills with online courses and internships, explore career alternatives, and stay updated with the latest educational news..
Gain high-quality, filtered student leads, prominent homepage ads, top search ranking, and a separate website. Let us actively enhance your brand awareness.