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
- Magic Link woes/noob
Magic Link is working; it sends the link to my email. But the link itself always leads to "Page Not Found. The page you're looking for doesn't exist". Clicking ...
- is `account.get()` safe to be used in th...
I want to user's `id` for authentication. However, a while ago I was told in this server not to use `account.get()` and instead add user preferences for that us...
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...