Back

Whats is the difference between Get User and Get user preferences

  • 0
  • Flutter
new user
26 Apr, 2023, 12:22

Whats is the difference between Get User and Get user preferences

TL;DR
The difference between 'Get User' and 'Get user preferences' functions is that 'Get User' returns the user object if the user is logged in, while 'Get user preferences' only works when the user is logged in and returns a generic JSON object with any custom fields that are in the user preferences. To check offline if a user has no internet, you cannot get valuable information from either of these functions as they require the user to be logged in.
Binyamin
26 Apr, 2023, 12:33

Each user has a place that can hold up to 64KB of information in a key-value pairs (In web it returns as JSON object)

Account.get() - Will return the user object when loggin and throw error in case not.

Account.getPrefs() - Will work only if the user is logged in, and will return a generic JSON object with any custom fields that are in the user preferences.

new user
26 Apr, 2023, 12:42

ok

new user
26 Apr, 2023, 12:43

will Account.getperfs() will work if user is offline for ,login check

Binyamin
26 Apr, 2023, 12:45

No, Account.getPrefs() will work only if the users is logged in, either by session or by JWT token.

new user
26 Apr, 2023, 12:46

so how ca we check offline, if user has no internet

Binyamin
26 Apr, 2023, 12:47

From what I've look into the code it's 100% online function That's means that in offline you won't be able to get valuable infromation from the function

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