Skip to content
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

Issue in solution of week-3/04-mongo-with-jwt-auth assignment #721

Open
aviralvardiya opened this issue Jan 12, 2024 · 0 comments
Open

Issue in solution of week-3/04-mongo-with-jwt-auth assignment #721

aviralvardiya opened this issue Jan 12, 2024 · 0 comments

Comments

@aviralvardiya
Copy link

week-3/04-mongo-with-jwt-auth/solution/middleware/admin.js
week-3/04-mongo-with-jwt-auth/solution/middleware/admin.js

In both the above mentioned files, the middleware just checks if the token is valid or not. However, it does not distinguish whether the token sent corresponds to a user or an admin. Consequently, a user can potentially access admin features by providing their token, and vice versa.

After token verification, the middleware should additionally validate whether the associated username belongs to an admin. If not, it should send an authentication failed error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant