I am facing issue with Getting Data from Firestore
Error : FirebaseError: Missing or insufficient permissions.
After changing the rule to below
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
Below is the Function from where i am trying to Call the database
async handelSearch(searchTerm: any) {
onAuthStateChanged(this.auth, async (user) => {
if (user) {
// User is signed in, see the user's uid
console.log(user.uid)
const querySnapshot = await getDocs(q);
let temp: any[]=[]
querySnapshot.forEach((doc) => {
// doc.data() is never undefined for query doc snapshots
temp.push(doc.data())
});
this.serachBarService.MemberList.update(() => temp);
// Access and modify user data here
} else {
console.log("No auth")
// User is signed out
}
});
}
I am successfully able to console log the User ID also Authentication seems working fine to me don’t know what’s missing while accessing the firestore.
I am working with Highly sensitive data here so can’t run database in Test mode
Any help is Appreciated, Thanks in Advance.
UPDATE :
I tested this in Emulator, Rule is working correctly there