Skip to content

This project demonstrates how to implement a secure user authentication system in Node.js, featuring user registration, login, logout, password encryption, and session management.

Notifications You must be signed in to change notification settings

CynthiaWahome/node-user-authentication

 
 

Repository files navigation

Build a Secure User Authentication System using Node.js

This project provides a fully functional Login, Register, and Logout system built with Node.js. It aims to offer a secure and robust user authentication system that can be integrated into various web applications.It aims to offer a secure and robust user authentication system that can be integrated into various web applications.

Features

  • User Registration: Allows users to create a new account with a secure password.
  • User Login: Enables users to log in to the application using their registered credentials.
  • User Logout: Provides a secure way for users to log out of the application.
  • Password Encryption: Ensures all user passwords are properly hashed and encrypted for security.
  • Session Management: Utilizes Passport for managing user sessions.

Getting Started

Follow these instructions to set up the project locally.

Prerequisites

Ensure you have the following installed:

Configuration

  1. Download or clone the repository to your local machine.

  2. Navigate to the project directory:

    cd user-authentication-system
  3. Install the dependencies:

    npm install
  4. Create a .env file in the root directory of the project and add the following environment variables:

    PORT=3000
    SESSION_SECRET=your_secret_key

    Make sure to replace your_secret_key with a strong secret key for session management.

Running the Application

  1. Start the application:

    npm start
  2. Open your browser and navigate to http://localhost:3000.

Usage

  • Register: Visit /register to create a new account.
  • Login: Visit /login to log in with your credentials.
  • Logout: Click the logout button to end the session.

Security Considerations

  • All passwords are hashed using bcryptjs to ensure they are stored securely.
  • Sessions are managed using secure cookies to prevent unauthorized access.

Documentation

For further details on the technologies used in this project, refer to the following documentation:

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes.

License

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

About

This project demonstrates how to implement a secure user authentication system in Node.js, featuring user registration, login, logout, password encryption, and session management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • EJS 79.7%
  • JavaScript 20.3%