admin管理员组

文章数量:1302867

Though all my rules in the firebase are correct i am still getting this issue in flutter (24.11.0

[Firestore]: Listen for Query(target=Query(AdviserInformation where [email protected] order by name);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}

can anyone please explain what is the root cause of this, below i will palce my firebase rules too ::

service cloud.firestore {
  match /databases/{database}/documents {
    // Allow read and write access to the "BuilderInformation" collection
    match /BuilderInformation/{document} {
      allow read, write: if true;
    }
     match /AdviserInformation/{document} {
      allow read, write: if true;
    }

    // Deny read and write access to all other documents
    match /{document=**} {
      allow read, write: if true;
    }
  }
} 

Here is my flutter sign in function code ::

  Future<void> signInChecker(
      String email, String password, BuildContext context) async {
    try {
      final result = await FirebaseFirestore.instance
          .collection('AdviserInformation')
          .where('AdviserEmail',
              isEqualTo: email.trim()) // Trim to remove accidental spaces
          .limit(1)
          .get();
      print("this is result :: ${result}");
      if (result.docs.isNotEmpty) {
        await _auth
            .signInWithEmailAndPassword(
                email: adviserEmail, password: adviserPassword)
            .then(
          (_) async {
            await _prefsAdv.setString('email', email);
            await _prefsAdv.setString('password', password);
            Get.offAllNamed('/adviser/home');
          },
        );
      } else {
        print("this is result :: ${result}");
        showCustomErrorSnackBar(context,
            'The given email is not registered. Please contact support.');
      }
    } catch (e) {
      if (e is FirebaseAuthException) {
        String errorMessage =
            'Please check your email/password, Contact admin for more';
        String dialogText = 'Error';

        if (e.code == 'wrong-password') {
          dialogText = 'Wrong Password';
          errorMessage = 'The password you entered is incorrect.';
        }

        showCustomErrorSnackBar(context, errorMessage);
      } else {
        showCustomErrorSnackBar(context, 'An unexpected error occurred.');
      }
      setState(() {
        isLoading = false;
      });
    }
  }

Here is a screenshot of my google rules playground I think it might help.

Also want to mention that this app is in production and i have did not modified the code for almost 1 year, after 1 year i am using this code and modifying it. was able to work on it for 3 days later i am getting this error while i want to login from past 2 days. I have updated the respective flutter packages too.

本文标签: Though all my firebase rules are correct still getting permission issue in my flutter appStack Overflow