Skip to content

UjjS/2FAapp-Two-factor-authentication-

Repository files navigation

2FA (Two-Factor Authentication) Application

This is a simple Node.js and Express application that demonstrates two-factor authentication (2FA) using Speakeasy, MongoDB for user storage, and QR codes for setup.

Prerequisites

Before running the application, make sure you have the following installed:

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/2fa-application.git
  2. Install dependencies:

    cd 2fa-application
    npm install
  3. Start the application:

    node index.js

    The server will be running on http://localhost:3000.

Usage

  1. Open your browser and go to http://localhost:3000.
  2. Fill in the registration form to register a new user. The server will provide a QR code for 2FA setup.
  3. Use an authenticator app (e.g., Google Authenticator) to scan the QR code and generate OTPs.
  4. Fill in the verification form with your username and the OTP generated by the authenticator app to verify.

Important Notes

  • This is a basic example for sample backend purposes. In a production environment, additional security measures and considerations should be implemented.

  • Make sure to secure your MongoDB connection and handle errors more gracefully in a real-world scenario.

  • The application is configured to connect to a MongoDB database named 2fa-example. Adjust the connection URI in index.js if needed.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This Node.js and Express app demonstrates Two-Factor Authentication (2FA) with Speakeasy and MongoDB. Users register, receive a unique QR code for 2FA setup, and verify using the generated one-time password (OTP).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors