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
- Invalid origin error in authentication
I have setup the package name same as the package name in app.json but it is constantly saying `AppwriteException: Invalid Origin. Register your new client as ...
- Functions Problem
Whenever I run my AI Generate through Appwrite Functions, I am getting this Call Stack AIService.generateServer (src\services\ai\gemini.ts) next (<native>) ...
- Auth working for emulator but not for ph...
hey guys i'm using appwrite for expo react native it is working perfectly for emulator but does not working for physical devices can u explain any one and it is...