I have created a Basic Version of a Two Factor Authentication using MongoDB as the Backend and using Node.js, EJS, Express.js and Passport.js as the Frontend! I have used the Passport-Local Strategy from Passport.js and the local authentication strategy authenticates users using a username and password.
To install and run this project,
You can download the zip file or Clone the Project Repository using Git with the below command:
git clone https://github.com/DhruvAthaide/TwoFactorAuthentication-MongoDB.git
Then, open the terminal in the project directory, and run the following command:
npm install
Once, you have installed the dependancies for the project using NodeJS, Open your Mongo DataBase using the MongoDB Compass GUI Application click on "Create a Database" and enter the following details:
Database Name: passport
Collection Name: users
Once, you have created the Database to store all the user data, you can run the following command in the terminal of the project directory to start the ExpressJS server using nodemon:
npm run dev
Then, you can paste the following address into your browser to access the LoginSignUp Server:
http://localhost:3000/