Authentify is a secure authentication system that uses JWT (JSON Web Tokens) to manage user sessions. The system supports user registration, login, and protected content access using JWT tokens. It also ensures password security by hashing passwords with bcrypt.
- User Registration
- User Login
- JWT-based Authentication
- Protected Routes
- Password Hashing with bcrypt
- Change Password
- Logout Functionality
- Node.js
- MongoDB
-
Clone the repository:
git clone https://github.com/hetpatel3/Authentify.git cd Authentify
-
Install dependencies:
npm install bcryptjs body-parser cookie-parser cors dotenv express jsonwebtoken mongoose
-
Set up your environment variables:
Create a
.env
file in the root directory and add your MongoDB URI, port, and JWT secret:MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/yourdatabase PORT=4000 TOKEN_SECRET=yourjwtsecret
-
Start the server:
node server.js
Your server should now be running on
http://localhost:4000
.
- Open
index.html
in your browser. - choose desirable action.
- Open
signup.html
in your browser. - Fill in the required details and submit the form.
- Open
login.html
in your browser. - Enter your registered email and password and submit the form.
- Open
jwtlogin.html
in your browser. - Enter your JWT token and submit the form.
- After logging in, you will be redirected to
content.html
. - This page can only be accessed if you are logged in.
- After logging in, You Can Change Your Password Using Your Existing Password.
- Click the "Logout" button on the
content.html
page to log out.
-
Secure User Authentication: Authentify provides a secure authentication system using JWT (JSON Web Tokens) to manage user sessions, ensuring robust user authentication for various applications.
-
User Registration: Authentify allows users to register for accounts, capturing essential user details such as username, email, and password, ensuring seamless onboarding experiences.
-
Protected Routes: With Authentify, developers can easily implement protected routes in their applications, allowing access to authenticated users only, enhancing application security.
-
Password Security: Authentify ensures password security by employing bcrypt for password hashing, safeguarding user credentials against unauthorized access and potential security breaches.
- Thanks to the open-source community for their contributions to libraries and frameworks used in this project.
- Special thanks to Hitesh Chaudhary and Harkirat Singh for their insightful YouTube channels, which provided valuable knowledge and inspiration for this project.