Back

How to refresh a token with node js sdk?

  • 0
  • Auth
  • Web
  • Cloud
Eilon
16 Oct, 2024, 10:38

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.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more