Skip to content
Back

Impossible to get USER after createEmailPasswordsessions. (ERROR 401 on account.get) Flutter for web

  • 0
  • Auth
  • Flutter
SylvainJack
12 Mar, 2026, 22:28

Am using provider to deal with functions linked to appwrite. Here is my login. Future<String?> login(String email, String password) async { try { await account.createEmailPasswordSession( email: email, password: password, ); print("Account est créé avec emails");

TypeScript
  late dynamic user;
  try {
    user = await account.get();
  } catch (e) {
    debugPrint("Impossible de récupérer l'utilisateur : $e");
  }
  print("user : $user)");
  if (user.labels.contains("admin")) {
    await fetchAdminData();
    return "admin";
  } else {
    await fetchCurrentOffreurData(email);
    return "offreur";
  }
} catch (e) {
  debugPrint("Erreur login: $e");
  return null;
}

}

I always get : Impossible de récupérer l'utilisateur : AppwriteException: general_unauthorized_scope, User (role: guests) missing scopes (["account"]) (401)

The session is created. But for some reason, user is considered GUEST even though session was created with email & password. So authentified.

TL;DR
Developers are unable to retrieve user information after creating email password sessions, getting a 401 error when trying to retrieve user data using Flutter/DART. The issue lies in the user being considered a guest despite authenticating with email and password. This is connected to missing scopes ('account') for the user role. To resolve this, developers need to ensure that the required scopes are set correctly.
SylvainJack
12 Mar, 2026, 22:33

Impossible to get USER after createEmailPasswordsessions. (ERROR 401 on account.get) Flutter/DART

SylvainJack
12 Mar, 2026, 22:53

Impossible to get USER after createEmailPasswordsessions. (ERROR 401 on account.get) Flutter for web

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