#Server SDK needs client services to work?

14 messages · Page 1 of 1 (latest)

dusk mountain
#

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.

The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity.

Register new user accounts with the [Create Account](/docs/references/cloud/client-web/accoun...

GitHub

Next.js/Appwrite boilerplate. Contribute to Babylon1999/nextjs-appwrite-boilerplate development by creating an account on GitHub.

naive heart
dusk mountain
#

I know, but how can I get the current user, shouldn't it be from the user's current session?

naive heart
dusk mountain
#

Maybe I didn't explain myself well, I want to check the currently logged in user using the cookie set from createEmailPasswordSession.

naive heart
dusk mountain
#

Well, I don't have a strong reason really. I'm just trying to understand how Appwrite works.

I would like to create a starter template that uses the server sdk and want to introduce my own rate limiting since the bandwidth in appwrite cloud is limited, so I want everything to go through my server first. Also just to have more control in general.

naive heart
dusk mountain
#

Here's a simple overview:

Get the cookie from request in my nextjs app -> setsession (as a user) -> go to appwrite api.

#

In other words, I want to set the session in the request using the admin client, but it's not working when the account service is disabled.

naive heart
dusk mountain