-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(backend): resolve issues in auth API endpoints, JWT strategy, and MongoDB connection #873
fix(backend): resolve issues in auth API endpoints, JWT strategy, and MongoDB connection #873
Conversation
…er and logout APIs
…sponse, remove console logs and add relevant response messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, @harmeetsingh11! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project.We will promptly review your changes and offer feedback. Keep up the excellent work!
✅ Deploy Preview for vintagevibe ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…add rate limiting to authentication routes using express-rate-limit
@harmeetsingh11 will it be worked? |
And also more over I need Backend linked to my MongoDB account instead of your 's |
@Anjaliavv51 Yes, it'll work as expected, when someone setup project locally. To work on live link, the project needs to redeployed with backend, as backend is not deployed only frontend is deployed on netlify. |
🎉 Your pull request has been successfully merged! 🎉 Thank you for your contribution to our project. Your efforts are greatly appreciated. Keep up the fantastic work! 🚀 |
@harmeetsingh11 it's done what is the NXT step we have to do |
@Anjaliavv51 Thanks for merging the PR. I tried to signin/signup using the frontend and noticed a significant issue: the backend APIs are not being called in frontend code. Instead, the signup/signin functionality is handled by Firebase, and the authentication logic for this implementation is incorrect/flawed. This further emphasizes the need for restructuring/refactoring the project. I’ve been evaluating ways to improve a project that feels cluttered and unorganized. The project includes embedded CSS and JS logic within HTML files, repeated code, and irrelevant HTML, CSS, JS, and Python files that are not used in the project. There are excessively long HTML and CSS files, which makes it challenging to maintain, debug, and update the project effectively. I’m considering two options to address these issues and would like know your thoughts on this: Option 1: Convert to React with JWT Backend or Backend as a service like firebase, appwrite etc
Proposed Folder Structure:
Advantages:
Disadvantages:
Option 2: Improve the Existing ProjectThis would involve refactoring the current setup by separating CSS and JavaScript into their own directories while keeping the backend logic intact. Proposed Folder Structure:
Advantages:
Disadvantages:
Recommendation: If your goal is long-term maintainability and scalability, convert to React with a backend. If you prefer a quick cleanup for better organization, opt for improving the current structure with backend. Looking forward to your advice. Let me know your thoughts on this. |
Backend Fixes and Enhancements
Issue
The backend code had several issues that prevented proper functioning of API endpoints, including incorrect file naming, invalid routes, and improper authentication handling. These issues resulted in failure to connect to the database and authenticate users.
Description of Changes
Corrected Auth Router Endpoint:
auth
router API endpoint was incorrect.Updated Logout Request Method:
logout
API fromGET
toPOST
.Minor Fixes in
authController.js
:Fixed JWT Auth Strategy:
getUser
andlogout
API endpoints were failing because the JWT strategy only checked for tokens in cookies.Authorization
header (bearer token).Files Changed
app.js
/api/auth
. This ensures all authentication-related endpoints are accessible under this base route.authRouter.js
POST
.authController.js
jwt.strategy.js
Authorization
header.Screenshots of API endpoints testing
API Testing:
api/auth/signin
API Testing:
api/auth/signup
API Testing:
api/auth/user
API Testing:
api/auth/logout
Checklist
main
branch before making this PR@Anjaliavv51 please review this PR. Let me know if further adjustments are needed.
Thank you for reviewing this PR! 🙌