Guys, is there any approach to get current logged account from the server-side?
Developing with Nextjs
get logged user from server-side [NextJs]
get logged user from server-side - NextJs
Check out the Users api https://appwrite.io/docs/references/cloud/server-nodejs/users#get
That wouldn’t help with “getting the currently logged in user”.
do you really need SSR?
Yes, I really do. I need it to get the author of a 'creation'. I mean, when someone create a post I need to get its account_id to set has the author of that post all of that in SSR
but why do you need SSR? Why not turn off SSR and do it client side?
It’s a personal choice, I’m new to the dev world. I think SSR is faster and more secure than CSR.
Also, using SSR will make it easier for me to redirect to the login page before fully loading the homepage. I’m developing my app using Next.js
honestly, especially if you're new, i recommend staying away from SSR because it adds complexity.
if you really want to continue using SSR, you'll either need to use JWT tokens or manually create a session server side so you can extract the session cookie from the header and fully manage it yourself (demo: https://next-js.ssr.almostapps.eu/).
We do have plans to improve SSR with Appwrite which can be found here: https://github.com/appwrite/rfc/pull/59
I’ll take on SSR, who knows, maybe with this challenge I’ll learn faster 😅 . Thank you for the tips, I’ll take a look.
Recommended threads
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- Custom emails
What happen if I use a third party email provider to customize my emails and my plan run out of emails/month? Appwrite emails are used as fallback sending emai...