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 app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741695674a2392990.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论