π Describe the bug
Bug
AuthStateController.onInit() unconditionally calls setUserProfileData(), which internally calls account.get().
When the user is not logged in, this results in:
401 general_unauthorized_scope (guest missing account scope)
Steps to Reproduce
- Launch app as a logged-out user
- AuthStateController initializes
- account.get() is called
- Appwrite throws 401
Expected Behavior
account.get() should only be called when a valid session exists.
Actual Behavior
account.get() is called for guest users, causing auth failure.
Fix
Guard setUserProfileData() with a login/session check:
if (await getLoginState) {
await setUserProfileData();
}