Giter Site home page Giter Site logo

auth-app-two-factor's Introduction

User Authentication and Two-Factor Authorization Application

This is a small application built to manage user authentication and two-factor authorization using Node.js, MongoDB, GraphQL, and JWT. The application allows users to register, change their password, and log in using two-factor authentication.

Table of Contents

Installation

  1. Make sure you have Node.js and npm installed on your system.
  2. Clone this repository: git clone https://github.com/shamkhall/auth-app-two-factor
  3. Navigate to the project directory: cd auth-app-two-factor
  4. Install dependencies: npm install

Startup

  1. Ensure that you have MongoDB installed and running on your system.
  2. Edit .env.example file as needed.
  3. Run the application: npm start

Functionality

1. User Registration

Users can register by providing their email and password. The data is stored securely in MongoDB.

2. Password Change

Users can change their password after logging in with their email and password.

3. User Authentication using JWT

Upon successful authentication, users receive a JWT token that grants them access to protected resources.

4. QR Code Generation for Two-Factor Authorization

Users can generate a QR code containing a secret key that is associated with their account for two-factor authorization.

5. Two-Factor Authorization Login

Users must enter their password and a one-time code generated from the QR code to successfully log in.

6. GraphQL API

The application provides a GraphQL API using Apollo Server for registration, login, get all users, password change, and two-factor authorization operations.

Project Structure

The project follows a clean and organized structure:

auth-app-two-factor/
├── src/
│   ├── auth/
│   ├── config/
│   ├── error/
│   ├── middleware/
│   ├── main.ts
├── .env.example
├── .gitignore
├── nodemon.json
├── package.json
├── package-lock.json
├── README.md
├── tsconfig.json

Security

  • User data is stored securely in MongoDB.
  • JWT is used for authentication, and a secure JWT secret key is required.
  • Two-factor authorization adds an extra layer of security using one-time codes.

SOLID Principles

The application adheres to SOLID principles by organizing code into separate modules and services for improved maintainability and scalability.

auth-app-two-factor's People

Contributors

shamkhall avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.