Loading video player...
In this video, I show you how to implement Two-Factor Authentication (2FA) in a Next.js App Router application using Better Auth and Prisma. You’ll learn how to build a complete real-world authentication flow — from signup, login, enabling 2FA, until verifying OTP codes using Google Authenticator. This video is perfect for both beginners and experienced developers who want to level up their authentication & security skills in Next.js apps. Prisma + Next.js blog: https://www.prisma.io/docs/guides/nextjs 🛠️ Tools & Packages Used: Next.js App Router: https://nextjs.org/ Better Auth: https://better-auth.com/ Prisma: https://www.prisma.io/ PostgreSQL: https://www.postgresql.org/ ⏱️ Timestamps: 00:00 - Introduction (Demo) 02:25 - Project setup (Next.js + Prisma + Better Auth) 11:28 - Create home, signup, signin and dashboard UI 14:00 - User signup & saving data to database 15:42 - Sign in flow & dashboard redirect 18:52 - Enabling 2FA from the dashboard 20:34 - Signing out & enforcing 2FA on next login 25:50 - Two-factor page 🌐 Check out more content: - My Portfolio: https://www.cand.site/ - Medium: https://medium.com/@ckriswinarto 💻 Get the Source Code: - GitHub: https://github.com/candraKriswinarto/better-auth-2fa 🌐 Recommended Digital Tools (Affiliate Links): - Hostinger: Get 20% Off on Web Hosting - https://dub.sh/zrpWarU