Member-only story

How To Implement Two-Factor Authentication Using Node.js and Vue 3

With time-based one-time password (TOTP)

Patrick Kalkman
Better Programming
9 min readJan 19, 2022

--

Photo by Morgan Housel on Unsplash

Last week, our product owner asked what it would take to add two-factor authentication to our system. We use Azure Active Directory, which means configuring an extra policy via the Azure portal. This was all we needed to do to enable two-factor authentication.

Triggered by the question of the product owner, I thought it was also time to add two-factor authentication to my side project. I wanted to use a common way of adding two-factor authentication, a Time-based One-Time Password.

This article describes how I used Node.js and Vue.js to implement two-factor authentication in my side project.

You can find the complete source code of the back-end and the front-end in this GitHub repository.

Two-factor Authentication

Two-factor or multi-factor authentication (MFA) is becoming a de facto standard for IT systems. You likely already use several MFA accounts, for example, from Google, GitHub, or Apple. If not, you should enable it!

Multi-factor authentication is a process where a user has to provide many forms of identification during a sign-in event. This could be a cell phone code or a fingerprint scan.

--

--

Patrick Kalkman
Patrick Kalkman

Written by Patrick Kalkman

IT Architect, Developer & Writer passionate about open-source, AI, and agile. Driven by lifelong learning and knowledge sharing.

No responses yet

Write a response