I have build a node js server with some protected routes by using a middleware.
The protected route is serving an index.html file / Javascript files ..
I need to grant access to those private routes to the logged in user only (email and password).
I manage to do that by passing at the url of the protected route - the user's token and his user id - so I check it in the middleware - and it's working. Problem is - the token valid only for 15 minutes.
Is my approach is valid? and what should I do to refresh the token?
Thanks
TL;DR
Developers built a Node.js server with protected routes using middleware that grants access to logged-in users only. Tokens expire in 15 minutes. Is their approach valid, and how can they refresh the token?
Solution: Consider implementing token refreshing using techniques like issuing new tokens or utilizing refresh tokens.