Closed Tumelo2748 closed 1 month ago
Great job on implementing the authentication system for admin users using JWT! I see you have added the registerAdmin and loginAdmin controllers and middleware like authenticateToken and isAdmin to secure the routes.
Since I'm still learning, I have a quick question: How does the authenticateToken middleware handle cases when a token is invalid?
Thanks for taking the time for testing the features locally!
So Jwt use verify to check if a token is valid or not, It check whether the token is expired or not Another way it checks if a token is valid or not is by checking if the jwt matches with the secret key
Description:
This PR adds authentication middleware for securing our applications using JWT.
Key Changes:
Admin Controller:
registerAdmin
andloginAdmin
controllers to handle authentication logic.Middleware:
authenticateToken
andisAdmin
middleware to protect admin-only routes.How Has This Been Tested?
authenticateToken
andisAdmin
middleware.Related Issue:
Checklist: