after reading what i could find on sessions (https://appwrite.io/docs/references/cloud/models/session) and account (https://appwrite.io/docs/references/cloud/client-react-native/accountI), i seem to understand that:
- $id is the session id
- the userId is the user id... however, when i run account.get() i seem to get the session id for both of those. there are no id's that match in my database atleast,
i have it setup like this:
client
.setEndpoint(config.endpoint)
.setProject(config.projectId)
.setPlatform(config.platform);
const account = new Account(client);
export async function getCurrentUser() {
try {
const user = await account.get();
console.log('Current user fetched:', user);
return user;
} catch (error) {
console.log('No active session:', error);
return null;
}
}
this returns something like this:
Current user: {"$createdAt": "2025-03-18T07:10:17.842+00:00", "$id": "[redacted]dc362c", "$updatedAt": "2025
-03-19T07:14:11.225+00:00", "accessedAt": "2025-03-19T07:14:11.220+00:00", "email": "quan@example.com", "emailVerification": tr
ue, "labels": ["admin"], "mfa": false, "name": "quan", "passwordUpdate": "2025-03-18T07:10:17.839+00:00", "phone": "", "phoneVe
rification": false, "prefs": {}, "registration": "2025-03-18T07:10:17.839+00:00", "status": true, "targets": [{"$createdAt": "202
5-03-18T07:10:17.896+00:00", "$id": "[redacted]5ebed2", "$updatedAt": "2025-03-18T07:10:17.896+00:00", "expired": false, "ide
ntifier": "junker@example.com", "name": "", "providerId": null, "providerType": "email", "userId": "[redacted]dc362c"}]}
the user id that i can see in the database (or collection) is "[redacted]2eefbb"
am i understanding the documentation wrong? am i reading the returned data wrong perhaps? i dont quite understand what is at work here, as it seem other users on the internet are just getting their id'd like they want.
any help is appreciated
it seems like i have indeed misunderstood. what is happening is that i am getting the user id from a schema or document, which is the same user as the one in auth. however, the id's arent the same, and i am ofcourse checking up on the auth id, against the other id, which would never be the same
Recommended threads
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Appwrite Storage error 503s for automate...
I'm facing error 503s from Appwrite after about 5-6 seconds of making AI requests from my tool with images and files above 20MB (=> not inline base64 used, but ...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...