How implement authentication in ssr
-
Does any one know how implement authentication in ssr mode? I have old SPA in quasar, implement authentication using “LocalStorage”(also store some user profile to LocalStorage), but I need SSR, so the offcial has description:
So I hope any example or solution to implement authentication in SSR -
Check out this post by Adam:
-
@nothingismagick Thank you! But Do you know some solution based on cookie or other native storage(Doesn’t like Firebase, it should connect to thrid-party)
-
I totally understand.
You can check out this starter that we built. Use feathers and connect to your DB on the server side.https://github.com/nothingismagick/quasar-starter-ssr-pwa-jest-cypress
-
@nothingismagick in the project, I did implemented api access in axios, then save token into local storage, then we need SSR to improve SEO, so we create blank quasar project in 0.17.19, move old project to new one. How the solution compatibility in the case? in 0.17.19 with SSR, localstorage can’t used to store data, we also save some user’s data in localstorage except save user’s token.
I saw the feathers solution, we need change all api access. BTW, the example has no solution for storage item in SSR, Should I implement it in cookie? -
yes, you should use cookie.
-
But you should REALLY take a deep look into what SSR is and does, specifically how to isolate components from the server / client in
quasar.conf.js