Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pranava007/fsd-auth-backend
This is a FSD Regsiter Login Forget-Password
https://github.com/pranava007/fsd-auth-backend
bcryptjs cors expressjs nodejs nodemailer
Last synced: about 3 hours ago
JSON representation
This is a FSD Regsiter Login Forget-Password
- Host: GitHub
- URL: https://github.com/pranava007/fsd-auth-backend
- Owner: pranava007
- Created: 2024-08-08T09:25:11.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-08T10:20:37.000Z (3 months ago)
- Last Synced: 2024-08-09T11:26:06.886Z (3 months ago)
- Topics: bcryptjs, cors, expressjs, nodejs, nodemailer
- Language: JavaScript
- Homepage: https://glittering-taffy-8bc914.netlify.app
- Size: 3.29 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# User Authentication and Password Management API
This project provides a basic user authentication system with functionalities including user registration, login, and password reset. It uses Node.js, Express, MongoDB, and various utility libraries like bcryptjs, jwt, and nodemailer for handling passwords and emails.
Key Features
User Registration (/register):Description: Registers a new user by hashing their password and storing it securely in the database.
Inputs: username, email, password (all required).
Outputs: Returns a success message and the registered user details upon successful registration.
User Login (/login):Description: Authenticates a user by validating their email and comparing the provided password with the hashed password in the database.
Inputs: email, password (both required).
Outputs: Returns a success message and a JWT token upon successful login.
Forget Password (/forgetPassword):Description: Sends a password reset email to the user with a link containing a token for resetting the password.
Inputs: email (required).
Outputs: Sends an email with a password reset link to the provided email address.
Reset Password (/resetPassword/:id/:token):Description: Verifies the reset token and allows the user to update their password.
Inputs: id, token (from URL parameters), and password (from request body).
Outputs: Returns a success message upon successful password reset.
Technical Stack
Backend: Node.js with Express framework.
Database: MongoDB for user data storage.
Libraries:
bcryptjs for password hashing.
jsonwebtoken for token generation and verification.
nodemailer for sending emails.
dotenv for environment variable management.
Environment Variables
PASSMAIL: Email address used to send password reset emails.
PASSKEY: Password for the email address used by nodemailer.
JWT_SECRET_KEY: Secret key used for signing JWT tokens.
MONGODB_URL: MongoDB connection string.
Error Handling
Uses a custom error handling utility (errorHandle) to manage and respond to various errors in the API.