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
- [SOLVED] What does avatars.getInitials r...
I am using this function and on logging the value i am getting something like `{"_h": 0, "_i": 0, "_j": null, "_k": null}` here is the code i used ```export fun...
- Auth not working on expo react native
I'm trying to launch a development server with expo go and appwrite as a backend. On my windows pc, I've got a local docker instance of appwrite running as my b...
- bug with permissions on react native
Hi when i set on a table some permission like all users read and write and then from the sdk I try to add a new row in that table I get this error: AppwriteExce...