Skip to content
Back

CSR with Serverside Auth

  • 0
  • 4
  • Auth
Flyto
2 Feb, 2026, 10:59

Hello everyone, according to best practices I would like to use server-side authentification as I would also like to render a big chunk of my app serverside. However, there are parts I would prefer to render client side which would require the webSDK correct? How can I authenticate the webSDK when using the serverSDK for auth? Do I need to authenticate in parallel? Or can I do it with token? Whats the most secure way?

TL;DR
Use JWT for client-side interactions after Serverside Auth with JWT. Follow the documentation at https://appwrite.io/docs/products/auth/server-side-rendering. Ensure cookie name matches and use a custom subdomain. Storing JWT in local storage is unsafe for production.
2 Feb, 2026, 14:54

Check out your

Use JWT to allow Client Side interactions after SSR Auth? Thread for the answer and I think this thread is not needed as the one I mentioned above has the same issue you have created so it's better not to create duplicates of the same issue.

1
3 Feb, 2026, 03:48

Follow https://appwrite.io/docs/products/auth/server-side-rendering especially the cookie name. And you'll have to use a custom domain that's a sub domain of your app. This way the session cookie goes to both your backend and Appwrite

1
3 Feb, 2026, 10:13

But if I would use multiple instances of my app on the same domain (e.g. deployment for company1.domain.com, company2.domain...) with the same appwrite instance, it would not be possible right? Isnt JWT Token the better and safer way of doing it or does this come with problems as well?

3 Feb, 2026, 17:21

Set the domain of the cookie to be the base domain.

No, JWT isn't a magical cure all

1
10 Feb, 2026, 06:21

Whats the downside of JWT? Currently I am also running the app on 2 different hostnames (a subsection of the application has its own hostname)...

10 Feb, 2026, 08:41

You mean storing the JWT at local storage then using it? If so, it's unsafe, that's why it's not recommended in production

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