Open samar12-rad opened 17 hours ago
Thank you for creating this issue! 🎉 We'll look into it as soon as possible. In the meantime, please make sure to provide all the necessary details and context. If you have any questions or additional information, feel free to add them here. Your contributions are highly appreciated! 😊
You can also check our CONTRIBUTING.md for guidelines on contributing to this project. for more information join our discord https://discord.gg/Jh3bWQ7FRN
Describe the feature
Incorporate Passport.js for Authentication Description Integrate Passport.js into the backend to handle user authentication using the local strategy with bcrypt for password comparison. Passport.js will be used for both sign-up and login processes.
Acceptance Criteria:
Passport.js Configuration: Configure Passport.js using passport-local strategy. Serialize and deserialize user information to manage sessions. Use bcrypt to compare hashed passwords during login.
Sign-Up Route (POST /api/signup): Hash passwords using bcrypt before storing them in the database. Ensure duplicate email check during user registration. On successful registration, allow automatic login (optional) or return a success message.
Login Route (POST /api/login): Authenticate using Passport’s LocalStrategy. If the credentials are valid, serialize the user and establish a session. Return an appropriate response based on authentication success or failure.
Logout Route (GET /api/logout): Use req.logout() to end the session. Return a success message upon successful logout. Technical Requirements:
Use passport-local for local authentication. Ensure bcrypt is used for password hashing. Use express-session for session management. Tasks:
Install necessary packages: passport, passport-local, bcryptjs, express-session. Create passport-config.js file to configure Passport.js. Add LocalStrategy for login in passport-config.js.
Add ScreenShots
Record