# How to Build Passkey Authentication with WebAuthn, Next.js and NestJS

DevFeed: [How to Build Passkey Authentication with WebAuthn, Next.js and NestJS](<https://devfeed.tech/articles/how-to-build-passkey-authentication-with-webauthn-next-js-and-nestjs-104247.md>)

Original publisher: [Read original article](<https://www.freecodecamp.org/news/how-to-build-passkey-authentication-with-webauthn-next-js-and-nestjs/>)

Author: Roland Mweze

Published: 2026-10-27T17:44:12Z

Content type: tutorial

Language: en

Sources: [Free Code Camp](<https://devfeed.tech/sources/freecodecamp-programming-tutorials-python-javascript-git-more.md>)

Topics: [Passkeys](<https://devfeed.tech/topics/passkeys.md>), [WebAuthn](<https://devfeed.tech/topics/webauthn.md>), [Nest](<https://devfeed.tech/topics/nestjs.md>), [Learning](<https://devfeed.tech/topics/learning.md>), [LocalStorage](<https://devfeed.tech/topics/localstorage.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [build](<https://devfeed.tech/tags/build.md>), [developers](<https://devfeed.tech/tags/developers.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [multiple](<https://devfeed.tech/tags/multiple.md>), [nestjs](<https://devfeed.tech/tags/nestjs.md>), [next-js](<https://devfeed.tech/tags/next-js.md>), [pain](<https://devfeed.tech/tags/pain.md>), [passkey](<https://devfeed.tech/tags/passkey.md>), [passkeys](<https://devfeed.tech/tags/passkeys.md>), [password](<https://devfeed.tech/tags/password.md>), [passwordless-authentication](<https://devfeed.tech/tags/passwordless-authentication.md>), [passwords](<https://devfeed.tech/tags/passwords.md>), [phishing](<https://devfeed.tech/tags/phishing.md>), [providers](<https://devfeed.tech/tags/providers.md>), [reuse](<https://devfeed.tech/tags/reuse.md>), [risk](<https://devfeed.tech/tags/risk.md>), [service](<https://devfeed.tech/tags/service.md>), [service-providers](<https://devfeed.tech/tags/service-providers.md>), [users](<https://devfeed.tech/tags/users.md>), [webauthn](<https://devfeed.tech/tags/webauthn.md>), [with](<https://devfeed.tech/tags/with.md>)

## AI overview

The tutorial builds email-based passkey registration and sign-in with a Next.js frontend, NestJS API, PostgreSQL, and SimpleWebAuthn. The server issues one-time WebAuthn challenges, checks the response's challenge, origin, RP ID, signature, and user-verification flag, then stores the public key and issues a JWT on sign-in. Passkeys use a device-held private key; the browser and operating system handle the biometric, PIN, or other local check, while RP ID binding helps resist phishing. The tutorial flags implementation risks: store credential IDs without encoding them again, clear challenges with null so TypeORM persists the change, scope credential lookup to the account, and require user verification consistently. It also notes that localStorage is for demo simplicity, recommends an httpOnly cookie for production, and suggests challenge expiry and migrations before production.

## Source excerpt

Passwords are a pain for both users and service providers․ Users often find it difficult to remember passwords, and the risk of phishing and password reuse across multiple websites is high. Developers