Skip to content
Back

Server SDK needs client services to work?

  • 0
  • Web
  • Cloud
BABYLON
19 Jun, 2024, 23:28

Hello!

I've been playing around with the server SDK and did a simple demo, but when I disabled the client services from the Appwrite dashboard, I could no longer get the current user. Given that my demo uses the server SDK, I was a bit confused.

How is someone expected to get the currently logged-in user with the server SDK? It seems like I can create a session, but not retrieve one.

Checking the docs, it's even more confusing: https://appwrite.io/docs/references/cloud/server-nodejs/account

In the Node.js example, the session is being set, but in the REST API, the header includes a JWT.

What am I missing here?

For reference, here's my code: https://github.com/Babylon1999/nextjs-appwrite-boilerplate/blob/main/utils/server/appwrite.ts

Note: I'm new to Node.js/Next.js, so any suggestions are appreciated.

TL;DR
Developers are having trouble retrieving the current user using the server SDK when client services are disabled. The confusion lies in setting up the session correctly. The solution is to pass the JWT token in the header when making requests to the Appwrite API.
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