How to implement JWT authentication in SolidJS, without SolidStart?
I'm currently learning SolidJS for a SPA app with JWT-based auth. Right now I'm trying to implement that JWT auth but I have a lot of problems and not sure if my approach is proper.
What I currently have is a
Then I would try to read that cookie in a top-level route component called
These are the cookie utils:
However, this seems to only set the cookie for one path, specifically in my case
What I currently have is a
<LoginPage/> that calls the API and then saves the token as a cookie. Then I would try to read that cookie in a top-level route component called
<AuthRedirector /> which is a root route with the app routes and auth routes as children. These are the cookie utils:
However, this seems to only set the cookie for one path, specifically in my case
/app/official-games. If I access any other /app/... route then I still get redirected to /auth/login and I check the browser's cookies and don't see cookies on these other routes. Plus, with this approach I still need to manually navigate to /app after successfully logging in