Back

AppwriteException: User (role: guests) missing scope (account)] React Native

  • 0
  • React Native
instrag
14 Nov, 2024, 21:23

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.'); }

TypeScript
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"); } };

TL;DR
AppwriteException error: User (role: guests) missing scope (account). Database issue reported, check status. Problem with fetching logged-in user info through API. Solution: Ensure proper user roles and scopes are set for account access.
Alpay Ergül
14 Nov, 2024, 21:35

There's a general problem with the database right now. Have you checked this?

https://status.appwrite.online/incident/461590?mp=true

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