
Hello, I'm having a problem with Appwrite. When I try to retrieve the logged in user information via the API, I get the following error: AppwriteException: User (role: guests) missing scope (account).
export const getCurrentUser = async () => { try { const sessions = await account.listSessions(); if (sessions.total === 0) { throw new Error('Aucune session active pour cet utilisateur.'); }
const currentAccount = await account.get();
if (!currentAccount)
throw new Error('Impossible de récupérer le compte actuel.');
const currentUser = await databases.listDocuments(
databaseId,
userCollectionId,
[Query.equal('accountId', currentAccount.$id)]
);
if (!currentUser)
throw new Error(
"Impossible de récupérer les informations de l'utilisateur."
);
return currentUser.documents[0];
} catch (error) { console.log("Erreur lors de la récupération de l'utilisateur :", error); throw new Error("Erreur lors de la récupération de l'utilisateur"); } };

There's a general problem with the database right now. Have you checked this?
Recommended threads
- Can not login with OAuth
Hello everyone i am trying to login with ios and android in react native - expo but it is not successful. And this is the code which i am using to login
- Appwrite realtime didn't work
``` useEffect(() => { const { client } = createClient(); const unsubscribe = client.subscribe(`databases.${process.env.EXPO_PUBLIC_APPWRITE_DATABASE}.t...
- createPhoneToken not working with expo
` const phoneResponse = await account.createPhoneToken(response.$id, phone);` this gives this error: `OTP error: [AppwriteException: Server Error]` * phone i...
