Skip to content

MERN Authentication System with email-based token validation

Notifications You must be signed in to change notification settings

hb99960/CodersBoutique

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Authentication API Project

Screenshot Screenshot

Objective :

The goal of this project is to build a complete set of authentication APIs that include functionalities for user login, signup, password recovery, and token management.

Tech Stack

Backend: Express.js - A web application framework for Node.js.

Database: MongoDB - A NoSQL database for storing user data and tokens.

Core Features

  1. Login API Allows users to authenticate with their credentials (email & password). Returns an access token and refresh token upon successful authentication.

  2. Signup API Allows new users to register by providing their details (e.g., name, email, password). Hashes the password for security before storing it in the database.

  3. Forgot Password API Enables users to request a password reset if they’ve forgotten their password. Sends an email with a reset link/token for password recovery.

  4. Reset Password API Users can set a new password using the token provided in the forgot password flow. Validates the token and ensures it hasn’t expired before allowing the password reset.

  5. Token Management Access Token: Short-lived tokens used for authenticating API requests. Refresh Token: Longer-lived tokens used to generate new access tokens without requiring the user to log in again. Tokens are securely managed and stored in the database with expiration times.

Installation and Setup

  1. Clone the repository

git clone https://github.com/hb99960/Coders-Boutique.git

  1. Navigate into the project directory:

cd backend

  1. Create a .env file in the root directory and add your environment variables:
PORT=3000
MONGO_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
NODE_ENV=development
EMAIL_USER=your_email
EMAIL_PASS=your_email_password
  1. Start the development server:

npm run dev

  1. The API will be available at http://localhost:3000/api/auth

API Endpoints

  1. Signup

    POST http://localhost:3000/api/auth/signup

  2. Logout

    POST http://localhost:3000/api/auth/logout

  3. Login

    POST http://localhost:3000/api/auth/login

  4. Forget Password

    POST http://localhost:3000/api/auth/forgot-password

  5. Reset Password

    POST http://localhost:3000/api/auth/reset/:token

  6. Reset Form

    GET http://localhost:3000/api/auth/reset-password/:token

About

MERN Authentication System with email-based token validation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published