How do I use sessions from an external API with httpOnly cookies?
Unanswered
Broad-snouted Caiman posted this in #help-forum
Broad-snouted CaimanOP
I have an app that has an Express backend and a Next frontend. The Express app uses Passport auth with express-session with httpOnly cookies. On the frontend I want to implement protected routes, such that, when a user navigates to a page a request is made to check if the session is valid and it it's not, redirect to the login page. My issue is, if I try to do this in a server component, the cookie is not attached to the request. What is the best way to implement protected routes in this fashion using client components?
1 Reply
Tonkinese
did you manage to solve this?