AOSSIE-Org / AOSSIE-Org/Resonate

AuthStateController calls account.get() on init causing 401 for guest users

Đang mở
#746 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Dart
Star
344
Fork
350
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 🐛 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
1. Launch app as a logged-out user
2. AuthStateController initializes
3. account.get() is called
4. 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:
```dart
if (await getLoginState) {
await setUserProfileData();
}

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.