This project demonstrates how to implement authentication using Passport.js in a Node.js application with Express and MongoDB.
- Clone the repository.
git clone https://github.com/raghabendra-dash/User_Authentication-API.git
- Install dependencies.
npm install
-
Set up environment variables.
-
Start the server.
node server.js
- Express
- Dotenv
- Cookie-parser
- Passport (middleware for Node-Authentication)
- Bcryptjs (library for hashing passwords securely)
- Mongoose
- Passport
- Register User:
_ Send a POST request to /register with JSON payload: _
{ "username": "John Doe", "password": "John.Doe123" }
- Login User:
_ Send a POST request to /login with JSON payload: _
{ "username": "John Doe", "password": "John.Doe123" }
Contributions are welcome! Fork the repository, make your changes, and submit a pull request.