Authentication System with JWT, passport.js, and MongoDB
This project is an authentication system built using JWT(JSON Web Tokens), Passport.js, and MongoDB as database . It provides secure user authentication and authorization functionalities for your web application.
- Clone the repository:
git clone https://github.com/Davheed2/Authentication-Sytem.git
- Install dependencies:
cd authentication-sytem
npm install
- Configure the environment variables:
PORT=5000 # Change as needed
ACCESS_SECRET=your_access_secret
REFRESH_SECRET=your_refresh_secret
- Start the server:
npm start
- Register a new user by making a POST request to /signup with a JSON body containing email and password. You will be given an access and refresh token which will be stored in the httpOnly secure cookie.
- Authenticate and log in a user by making a POST request to /login with valid credentials. You will be given an access and refresh token which will be stored in the httpOnly secure cookie.
- Access protected routes by including the JWT token in the Authorization header of your requests.
- Manage user profiles and data through the appropriate endpoints.
Contributions are welcome! Please follow the Contributing Guidelines to get started.
This project is licensed under the MIT Licence.
Feel free to reach out if you have any questions or issues related to this project.