Back

[Solved] how to get user prefs from serverside

  • 0
  • Self Hosted
  • Accounts
  • Flutter
Ireneus
3 Mar, 2024, 17:16

i want to get a specific users preferences from serverside maybe i missunderstood something

TL;DR
Developers wanted to retrieve user preferences from the server side using Appwrite. The solution is to use the Server Side SDKs with the following code snippet: ```javascript const user = await users.get('[USER_ID]'); const prefs = user.getPrefs() ```
Ireneus
3 Mar, 2024, 17:18

the docs dont show it

D5
3 Mar, 2024, 17:18

I think it's that?

Ireneus
3 Mar, 2024, 17:19

but how do i know what user its from?

D5
3 Mar, 2024, 17:20

I think inside account.getPrefs() you can put the user object.

D5
3 Mar, 2024, 17:20

It should be in the docs 🤔

darShan
3 Mar, 2024, 17:27

If by server-side you mean using a Server Side SDK with API Key?

Ireneus
3 Mar, 2024, 17:28

yes, im eating rn ill check if its possible and let you guys know

Ireneus
3 Mar, 2024, 17:36

nope it doesnt have anything that inputs userid

Ireneus
3 Mar, 2024, 17:37

weird

darShan
3 Mar, 2024, 17:38

On Client Side, account.getPrefs() should be called after the user is successfully logged in which doesn't require passing any userID.

Ireneus
3 Mar, 2024, 17:39

this is serverside though

darShan
3 Mar, 2024, 17:40

However, on the Server Side SDKs you do -

TypeScript
const user = await users.get('[USER_ID]');
const prefs = user.getPrefs()
Ireneus
3 Mar, 2024, 17:40

oh i see lemme check

Ireneus
3 Mar, 2024, 17:44

[Solved] how to get user prefs from serverside

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