I have been updating my firestore rules and the simulator works as expected but for some reason when i create a new document i get insufficient permissions error
Here are the firebase rules
match /users/{usersid} {
allow read, update, get: if request.auth.uid == usersid
allow create: if request.auth.uid != usersid
}
And here is how i am trying to add a document
constructor(private afs: AngularFirestore) {}
this.afs.doc(`users/${user['user'].uid}`).set(data, {merge: true}).then((res) => {
console.log(res);
}).catch((error) => {
console.log(error);
})
So my Question is are the rules OK? or is it to do with the way i am creating a document?
Ok the fix was the rule for the create wasn't allowing it so i just added it to the same rule as the other
allow read, update, get, create: if request.auth.uid == usersid
and that allowed it to work again😅