Two-factor authentication flow with Node and React
Time-based OTP (TOTP) is an algorithm that factors in the current time to generate a unique one-time password. TOTP (Time-based one-time password) provides the current time (typically in 30 seconds increments) as a counter value to generate a one-time password
In today’s age, it is a no-brainer that passwords alone can’t keep the bad guys out. You need an additional layer of security — a second factor.
It’s secure because:
- The password changes every n number of seconds (usually, 30 seconds), preventing eavesdroppers from using that same password later in the future if somehow they’re able to get hold of it.
- The password may be generated by an app on the user’s phone, making it more difficult for an attacker to acquire the password, as the user’s phone is usually by his/her side
- In mobile app implementations, the user only needs to launch the TOTP application and then key-in the TOTP that appears on-screen into the application.
- Unlike most mobile-based one-time passwords that need to be received via a text message or the Internet through some wireless connection, TOTPs aren’t dependent on the presence of a cellular signal or data connection.
- Install dependencies:
npm install
- Start the server:
node app.js
- Start front-end:
npm run start