Skip to content
Back

issue authenticating new user : [AppwriteException: User (role: guests) missing scope (account)]

  • 0
  • React Native
icarus
23 Apr, 2025, 17:09

i am currently facing an issue that didn't appear except few days back now, and so far i've tried and can't fix it i created a platform integration using my applicationId from android/app/build.gradle after doing a prebuild as i've changed the package name few commits back in the project.

doing few logs to check where the issue is coming from

TypeScript
async function login(email: string, password: string): Promise<void> {
    try {
      console.log("logging");
      const result = await account.createEmailPasswordSession(email, password);
      console.log(result);
      await new Promise((resolve) => setTimeout(resolve, 500));
      console.log("getting user details");

      const userDetails = await account.get(); //stops here and throws the error
      console.log("user details acquired");
      initializeUserId(userDetails.$id);

      setUser(userDetails as User);
      console.log(user);

      ToastGlue("Welcome back. You are logged in");
    } catch (error) {
      //console.error("Login error:", error);
      ToastGlue("Login failed. Please check your credentials.");
      throw error;
    }
  }
TL;DR
Developers facing authentication issue due to user role missing necessary scope 'account'. The error occurs during attempt to get user details after creating an email password session. Testing tools like burpsuite being used for further investigation. Possible solution may involve adjusting user role permissions. Solution: Ensure the user's role has the required scope 'account' for successful authentication.
icarus
23 Apr, 2025, 17:13

the console logs

TypeScript
 (NOBRIDGE) LOG  logging
 (NOBRIDGE) LOG  {"$createdAt": "2025-04-21T15:01:39.803+00:00", "$id": "redacted", "$updatedAt": "2025-04-21T15:01:39.803+00:00", "clientCode": "", "clientEngine": "", "clientEngineVersion": "", "clientName": "OkHttp", "clientType": "library", "clientVersion": "4.12", "countryCode": "xx", "countryName": "redacted", "current": true, "deviceBrand": "", "deviceModel": "", "deviceName": "", "expire": "2026-04-21T15:01:39.758+00:00", "factors": ["password"], "ip": "redacted", "mfaUpdatedAt": "", "osCode": "AND", "osName": "Android", "osVersion": "", "provider": "email", "providerAccessToken": "", "providerAccessTokenExpiry": "", "providerRefreshToken": "", "providerUid": "xxxxxx@gmail.com", "secret": "", "userId": "redacted"}
 (NOBRIDGE) LOG  getting user details
 (NOBRIDGE) ERROR  Login error: [AppwriteException: User (role: guests) missing scope (account)]

the image i incorporated, i just wanted to clear that the session gets created, i've made sure the clear all sessions before the point for test, just to clearly show that there's a new session in progress. i'll continue testing, with tools like burpsuite, to catch the request that's being sent.

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