Skip to content

Commit 3670a48

Browse files
author
mostafamoqbelibrahim
committed
resolved conflicts
2 parents 8d4e17c + 8c50eba commit 3670a48

16 files changed

+748
-1
lines changed

content/authentication-protocols/index.md

Lines changed: 333 additions & 0 deletions
Large diffs are not rendered by default.
144 KB
Loading
311 KB
Loading
462 KB
Loading

content/biometric-auth/index.md

Lines changed: 202 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
---
2+
title: "WebAuthn Explained"
3+
description: "A comprehensive guide to understanding WebAuthn, its benefits, and implementation details."
4+
date: 2025-10-14
5+
cover: "webauthn-explained.png"
6+
author: "Joel Coutinho"
7+
category: "programming"
8+
---
9+
10+
11+
WebAuthn—short for *Web Authentication*—is a modern standard that lets users log in securely without relying on passwords. Instead, it uses public‑key cryptography to verify identity, making phishing and credential theft far harder.
12+
13+
In simple terms, a website (called the *relying party*) asks a browser and its authenticator—like your laptop’s fingerprint sensor or a security key—to create or use a cryptographic key pair. The private key never leaves your device. The public key gets stored by the website. That separation makes WebAuthn both secure and privacy‑preserving.
14+
15+
WebAuthn is part of the broader **FIDO2 framework**, which also includes **CTAP** (Client to Authenticator Protocol). Together, they enable a wide range of authenticators—from YubiKeys and Windows Hello to Face ID and Android biometrics.
16+
17+
In this guide, we’ll unpack why WebAuthn exists, how it works in practice, and how frameworks like **SuperTokens** make it easier to implement in your app.
18+
19+
---
20+
21+
## Why WebAuthn Exists: Fixing the Password Problem
22+
23+
Passwords have been the default way to secure online accounts for decades—but they’ve always been fragile.
24+
25+
- **Phishing is easy.** Fake sites can trick users into typing their passwords, which attackers reuse elsewhere.
26+
- **Password reuse is rampant.** One breach often cascades into many.
27+
- **Weak passwords abound.** Even complex ones can be guessed or brute‑forced.
28+
- **Servers are single points of failure.** Even hashed passwords can be cracked offline after a data leak.
29+
30+
WebAuthn removes these weaknesses by design. Instead of a shared secret, it relies on **asymmetric cryptography**—a private key stored on the user’s device and a public key on the server. Authentication works by signing a random challenge rather than sharing a password, so nothing reusable ever leaves the user’s control.
31+
32+
This means: no shared secrets, no phishing risk, and no password databases waiting to be breached.
33+
34+
---
35+
36+
## How the Web Authentication API Works
37+
38+
The **Web Authentication API** is built directly into modern browsers. It allows web apps to register and verify cryptographic credentials for:
39+
40+
- Passwordless logins
41+
- Two‑factor authentication
42+
- Phishing‑resistant passkeys
43+
44+
Here’s how it works at a high level.
45+
46+
### Registration Flow
47+
1. The server sends a **challenge** to the browser.
48+
2. The browser calls `navigator.credentials.create()` to ask the authenticator to generate a new credential.
49+
3. The authenticator creates a **public‑private key pair**.
50+
4. The private key stays securely on the device; the public key and credential ID go to the server.
51+
5. The server stores that information for future logins.
52+
53+
### Authentication Flow
54+
1. The server sends another **challenge** to verify identity.
55+
2. The browser calls `navigator.credentials.get()` to have the authenticator sign it.
56+
3. The authenticator signs the challenge using the stored private key.
57+
4. The browser returns the signed data to the server.
58+
5. The server verifies it with the stored public key.
59+
60+
Because the credential is **bound to the origin** (for example, `example.com`), phishing attempts from fake domains fail automatically.
61+
62+
---
63+
64+
## Example: WebAuthn in Action
65+
66+
Here’s a simplified TypeScript example of a client‑side registration flow using the Web Authentication API.
67+
68+
```ts
69+
const options = {
70+
challenge: Uint8Array.from(atob(serverChallenge), c => c.charCodeAt(0)),
71+
rp: { name: "My App", id: "example.com" },
72+
user: {
73+
id: Uint8Array.from(atob(userIdBase64), c => c.charCodeAt(0)),
74+
name: userEmail,
75+
displayName: userFullName
76+
},
77+
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
78+
authenticatorSelection: { userVerification: "preferred" },
79+
attestation: "none"
80+
};
81+
82+
navigator.credentials.create({ publicKey: options })
83+
.then(cred => {
84+
// Send credential info to server for verification
85+
})
86+
.catch(err => console.error("Registration failed", err));
87+
```
88+
89+
Behind the scenes, your browser communicates with the authenticator (e.g., fingerprint reader, security key, or platform chip). No passwords are exchanged—only signed cryptographic proof that you’re the same person who registered earlier.
90+
91+
---
92+
93+
## WebAuthn and SuperTokens: Passwordless Made Simple
94+
95+
While WebAuthn provides the underlying standard, integrating it securely takes effort. That’s where **SuperTokens** helps. It’s an open‑source authentication framework that simplifies adding passwordless or passkey‑based login to your app.
96+
97+
### Why Use SuperTokens with WebAuthn
98+
99+
- **Built‑in passkey support:** SuperTokens offers ready‑to‑use backend recipes and frontend SDKs (Node.js, Python) for passwordless flows.
100+
- **Configurable security:** You can easily customize your relying party ID, attestation policy, or authenticator settings.
101+
- **Fallback ready:** Combine WebAuthn with magic links, OTPs, or passwords to cover devices that don’t yet support passkeys.
102+
- **Open‑source control:** You have full visibility into the backend logic—no vendor lock‑in or black boxes.
103+
104+
[Get started now](https://supertokens.com/docs/authentication/passkeys/introduction)
105+
106+
---
107+
108+
## Practical Tips for Developers
109+
110+
Before diving into production, consider these common challenges and best practices:
111+
112+
- **Always generate challenges on the server.** Never reuse or predict them.
113+
- **Ensure correct origin and relying party ID.** Even a mismatched subdomain can cause silent failures.
114+
- **Offer multiple authenticators.** Encourage users to register at least two (e.g., a device biometric and a hardware key).
115+
- **Design fallback flows.** Account for device loss or unsupported browsers.
116+
- **Test across browsers and platforms.** Safari, Chrome, and Edge each have subtle quirks.
117+
118+
With thoughtful UX and the right libraries, WebAuthn can deliver a login experience that’s both secure and user‑friendly.
119+
120+
---
121+
122+
## The Future: Passkeys Everywhere
123+
124+
You’ve probably heard the term *passkey*. It’s simply a user‑friendly name for WebAuthn credentials that sync across devices through cloud services like iCloud Keychain or Google Password Manager. Passkeys make WebAuthn even more practical by solving the “new device” problem.
125+
126+
The industry momentum is clear: Apple, Google, and Microsoft now fully support passkeys. As adoption grows, we’re heading toward a world where passwords finally fade into the background—and secure logins just *work*.
127+
128+
---
129+
130+
## Conclusion
131+
132+
WebAuthn changes the game for web authentication. By replacing passwords with public‑key cryptography, it eliminates phishing risks, credential reuse, and password fatigue—all while improving the user experience.
133+
134+
For developers, adopting WebAuthn directly can be complex, but frameworks like **SuperTokens** make it approachable. Whether you’re building a startup or securing enterprise users, passwordless authentication is no longer a futuristic goal—it’s ready to use today.

src/authors-details.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = [
3131
},
3232
{
3333
name: "Rishabh Poddar",
34-
jobTitle: "Co-Founder and CTO at SuperTokens",
34+
jobTitle: "Ex-CTO at SuperTokens",
3535
image: "rishabh.jpg",
3636
socials: [
3737
{
898 KB
Loading

static/blog-seo/config.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3323,6 +3323,29 @@
33233323
"title": "Auth0 vs FusionAuth (2025): Pricing, Hosting, Use Cases",
33243324
"schema": "<script type=\"application/ld+json\"> {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Article\",\n \"mainEntityOfPage\": {\n \"@type\": \"WebPage\",\n \"@id\": \"https://supertokens.com/blog/auth0-vs-fusionauth\"\n },\n \"headline\": \"Auth0 vs FusionAuth in 2025: pricing, hosting (SaaS vs self-host), DX, and best-fit use cases—plus an open-source alternative to consider.\",\n \"image\": \"https://supertokens.com/blog-meta-images/auth0-vs-fusionauth.png\",\n \"author\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"url\": \"https://supertokens.com\"\n },\n \"publisher\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"logo\": {\n \"@type\": \"ImageObject\",\n \"url\": \"https://supertokens.com/static/assets/dark-home/logo.png\"\n }\n }\n }</script>"
33253325
},
3326+
{
3327+
"path": "/blog/biometric-auth",
3328+
"metaTags": [
3329+
"<meta name=\"description\" content=\"Understand biometric authentication on the web: how it works, use cases, security benefits, and how to implement it using WebAuthn.\" />",
3330+
"",
3331+
"<meta name=\"keywords\" content=\"Authentication, Open Source, Authorization, User Management, OAuth, Enterprise SSO, Security\" />",
3332+
"<!--OG Tags-->",
3333+
"<meta property=\"og:title\" content=\"Biometric Web Authentication: What It Is and How to Use It\" />",
3334+
"<meta property=\"og:type\" content=\"article\" />",
3335+
"<meta property=\"og:url\" content=\"https://supertokens.com/blog/biometric-auth\" />",
3336+
"<meta property=\"og:description\" content=\"Understand biometric authentication on the web: how it works, use cases, security benefits, and how to implement it using WebAuthn.\"/>",
3337+
"<meta property=\"og:image\" content=\"https://supertokens.com/blog-meta-images/biometric-web-auth.png\" />",
3338+
"",
3339+
"<meta name=\"twitter:card\" content=\"summary_large_image\" />",
3340+
"<meta name=\"twitter:title\" content=\"Understand biometric authentication on the web: how it works, use cases, security benefits, and how to implement it using WebAuthn.\" />",
3341+
"<meta name=\"twitter:url\" content=\"https://supertokens.com/blog/biometric-auth\" />",
3342+
"<meta name=\"twitter:image\" content=\"https://supertokens.com/blog-meta-images/biometric-web-auth.png\" /> ",
3343+
"<!--OG Tags-->",
3344+
"<link rel=\"canonical\" href=\"https://supertokens.com/blog/biometric-auth\">"
3345+
],
3346+
"title": "Biometric Web Authentication: What It Is and How to Use It",
3347+
"schema": "<script type=\"application/ld+json\"> {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Article\",\n \"mainEntityOfPage\": {\n \"@type\": \"WebPage\",\n \"@id\": \"https://supertokens.com/blog/biometric-auth\"\n },\n \"headline\": \"Understand biometric authentication on the web: how it works, use cases, security benefits, and how to implement it using WebAuthn.\",\n \"image\": \"https://supertokens.com/blog-meta-images/biometric-web-auth.png\",\n \"author\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"url\": \"https://supertokens.com\"\n },\n \"publisher\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"logo\": {\n \"@type\": \"ImageObject\",\n \"url\": \"https://supertokens.com/static/assets/dark-home/logo.png\"\n }\n }\n }</script>"
3348+
},
33263349
{
33273350
"path": "/blog/oidc-vs-saml",
33283351
"metaTags": [
@@ -4450,6 +4473,29 @@
44504473
"title": "Fixing CORS Errors What They Are and How to Resolve Them",
44514474
"schema": "<script type=\"application/ld+json\"> {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Article\",\n \"mainEntityOfPage\": {\n \"@type\": \"WebPage\",\n \"@id\": \"https://supertokens.com/blog/cors-errors\"\n },\n \"headline\": \"Learn what causes CORS errors, how they impact your web app, and how to fix them securely with proper headers and backend configurations.\",\n \"image\": \"https://supertokens.com/blog-meta-images/cors_errors.png\",\n \"author\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"url\": \"https://supertokens.com\"\n },\n \"publisher\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"logo\": {\n \"@type\": \"ImageObject\",\n \"url\": \"https://supertokens.com/static/assets/dark-home/logo.png\"\n }\n }\n }</script>"
44524475
},
4476+
{
4477+
"path": "/blog/webauthn-explained",
4478+
"metaTags": [
4479+
"<meta name=\"description\" content=\"A comprehensive guide to understanding WebAuthn, its benefits, and implementation details.\" />",
4480+
"",
4481+
"<meta name=\"keywords\" content=\"Authentication, Open Source, Authorization, User Management, OAuth, Enterprise SSO, Security\" />",
4482+
"<!--OG Tags-->",
4483+
"<meta property=\"og:title\" content=\"WebAuthn Explained\" />",
4484+
"<meta property=\"og:type\" content=\"article\" />",
4485+
"<meta property=\"og:url\" content=\"https://supertokens.com/blog/webauthn-explained\" />",
4486+
"<meta property=\"og:description\" content=\"A comprehensive guide to understanding WebAuthn, its benefits, and implementation details.\"/>",
4487+
"<meta property=\"og:image\" content=\"https://supertokens.com/blog-meta-images/webauthn-explained.png\" />",
4488+
"",
4489+
"<meta name=\"twitter:card\" content=\"summary_large_image\" />",
4490+
"<meta name=\"twitter:title\" content=\"A comprehensive guide to understanding WebAuthn, its benefits, and implementation details.\" />",
4491+
"<meta name=\"twitter:url\" content=\"https://supertokens.com/blog/webauthn-explained\" />",
4492+
"<meta name=\"twitter:image\" content=\"https://supertokens.com/blog-meta-images/webauthn-explained.png\" /> ",
4493+
"<!--OG Tags-->",
4494+
"<link rel=\"canonical\" href=\"https://supertokens.com/blog/webauthn-explained\">"
4495+
],
4496+
"title": "WebAuthn Explained",
4497+
"schema": "<script type=\"application/ld+json\"> {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Article\",\n \"mainEntityOfPage\": {\n \"@type\": \"WebPage\",\n \"@id\": \"https://supertokens.com/blog/webauthn-explained\"\n },\n \"headline\": \"A comprehensive guide to understanding WebAuthn, its benefits, and implementation details.\",\n \"image\": \"https://supertokens.com/blog-meta-images/webauthn-explained.png\",\n \"author\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"url\": \"https://supertokens.com\"\n },\n \"publisher\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"logo\": {\n \"@type\": \"ImageObject\",\n \"url\": \"https://supertokens.com/static/assets/dark-home/logo.png\"\n }\n }\n }</script>"
4498+
},
44534499
{
44544500
"path": "/blog/launch-week-02-open-source-auth-plugins",
44554501
"metaTags": [
@@ -4518,5 +4564,28 @@
45184564
],
45194565
"title": "What Is a YubiKey and When to Use It vs. Authenticator Apps",
45204566
"schema": "<script type=\"application/ld+json\"> {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Article\",\n \"mainEntityOfPage\": {\n \"@type\": \"WebPage\",\n \"@id\": \"https://supertokens.com/blog/yubikeys\"\n },\n \"headline\": \"Discover how YubiKeys work, when to choose them over authenticator apps, and how to integrate both in your auth flow.\",\n \"image\": \"https://supertokens.com/blog-meta-images/what_is_a_yubikey.png\",\n \"author\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"url\": \"https://supertokens.com\"\n },\n \"publisher\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"logo\": {\n \"@type\": \"ImageObject\",\n \"url\": \"https://supertokens.com/static/assets/dark-home/logo.png\"\n }\n }\n }</script>"
4567+
},
4568+
{
4569+
"path": "/blog/authentication-protocols",
4570+
"metaTags": [
4571+
"<meta name=\"description\" content=\"Explore various authentication protocols, their types, and delve into email authentication methods like SPF, DKIM, and DMARC to enhance security.\" />",
4572+
"",
4573+
"<meta name=\"keywords\" content=\"Authentication, Open Source, Authorization, User Management, OAuth, Enterprise SSO, Security\" />",
4574+
"<!--OG Tags-->",
4575+
"<meta property=\"og:title\" content=\"Understanding Authentication Protocols: Types and Security Measures\" />",
4576+
"<meta property=\"og:type\" content=\"article\" />",
4577+
"<meta property=\"og:url\" content=\"https://supertokens.com/blog/authentication-protocols\" />",
4578+
"<meta property=\"og:description\" content=\"Explore various authentication protocols, their types, and delve into email authentication methods like SPF, DKIM, and DMARC to enhance security.\"/>",
4579+
"<meta property=\"og:image\" content=\"https://supertokens.com/blog-meta-images/authentication-protocols.png\" />",
4580+
"",
4581+
"<meta name=\"twitter:card\" content=\"summary_large_image\" />",
4582+
"<meta name=\"twitter:title\" content=\"Explore various authentication protocols, their types, and delve into email authentication methods like SPF, DKIM, and DMARC to enhance security.\" />",
4583+
"<meta name=\"twitter:url\" content=\"https://supertokens.com/blog/authentication-protocols\" />",
4584+
"<meta name=\"twitter:image\" content=\"https://supertokens.com/blog-meta-images/authentication-protocols.png\" /> ",
4585+
"<!--OG Tags-->",
4586+
"<link rel=\"canonical\" href=\"https://supertokens.com/blog/authentication-protocols\">"
4587+
],
4588+
"title": "Understanding Authentication Protocols: Types and Security Measures",
4589+
"schema": "<script type=\"application/ld+json\"> {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Article\",\n \"mainEntityOfPage\": {\n \"@type\": \"WebPage\",\n \"@id\": \"https://supertokens.com/blog/authentication-protocols\"\n },\n \"headline\": \"Explore various authentication protocols, their types, and delve into email authentication methods like SPF, DKIM, and DMARC to enhance security.\",\n \"image\": \"https://supertokens.com/blog-meta-images/authentication-protocols.png\",\n \"author\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"url\": \"https://supertokens.com\"\n },\n \"publisher\": {\n \"@type\": \"Organization\",\n \"name\": \"SuperTokens\",\n \"logo\": {\n \"@type\": \"ImageObject\",\n \"url\": \"https://supertokens.com/static/assets/dark-home/logo.png\"\n }\n }\n }</script>"
45214590
}
45224591
]

0 commit comments

Comments
 (0)