
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
- Bypass Error When Creating Account With ...
Suppose user first uses email/pass for log in using xyz@gmail.com, few month later on decides to use google oauth2 with same xyz@gmail.com (or in reverse orde...
- No mails from Appwrite
Hello, Since severals days, i have a problem : i d'ont received any mails from Appwrite. I'm using the auth by mail and i don't any code so any mails from App...
- wrong code for google oauth2 ?
gives User (role: guests) missing scope (account) error
