Skip to content

A Node.js authentication system with JWT, Redis session management, email verification, and HttpOnly cookies for secure login and registration. Includes password hashing and session handling for a seamless and secure user experience.

Notifications You must be signed in to change notification settings

psymore/auth-jwt-http-cookie-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Auth Starter Project

This is a simple Node.js project template, designed to get you started quickly with server-side development. It includes a basic setup with a minimal HTTP server, ideal for learning Node.js or kickstarting your backend development.

Features

  • User Registration: Secure registration with email verification. The user is temporarily stored in Redis and receives a confirmation email with a verification token.
  • JWT Authentication: Login system using JWT (JSON Web Tokens) for secure session management. The JWT is stored in an HttpOnly cookie to prevent client-side access.
  • Redis Integration: Redis is used for session management, temporary storage of user data, and blacklisting tokens during logout for added security.
  • Password Hashing: Passwords are securely hashed using bcrypt before storing them in the database.
  • Email Confirmation: A confirmation link with a JWT token is sent to the user for email verification, ensuring a valid email before user creation.
  • Login & Session Management: User login with token-based authentication. If the user is already logged in, the existing token is returned.
  • Secure Logout: JWT token is blacklisted in Redis, and the HttpOnly cookie is cleared during logout to invalidate the session.
  • HttpOnly Cookies: JWT tokens are stored in HttpOnly cookies to protect them from XSS attacks and ensure server-side authentication.
  • Error Handling: Detailed error handling for different stages of user registration, login, and token management.

About

A Node.js authentication system with JWT, Redis session management, email verification, and HttpOnly cookies for secure login and registration. Includes password hashing and session handling for a seamless and secure user experience.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published