FayeOriginal post
Rank 6: Server
Heyo!
Does anyone have a valid way of being able to support both SSR and CSR?
For example, what if I want to do account.get() on a client sided page, following the tutorial on the docs will show a 401 on CSR, but 200 on SSR.
The web sdk client creates cookies on the domain where the API is located (for example cloud.appwrite.io), but not on the domain itself. This is fine, but if you sign in via SSR, the cookies will not exist on that domain and so the CSR side will not work.
Any idea how to support both? 🤔
Summary
Title: Supporting SSR & CSR with Next.js 14
Developers are looking for help to support both SSR and CSR. A common issue is facing 401 error on CSR after following tutorials that work fine on SSR. Cookies created by web SDK client are not available on both domains causing authentication problems. One solution is to manage cookies globally using a package like js-cookie to ensure they work on both sides.