Reputation: 66355
When a user is created I need to add some additional data about the user (e.g. name).
So I need a publicly writable collection. However I've tried adding create
and update
(I think that's for set
and add
respectively), but I'm still getting "Error: Missing or insufficient permissions." when trying to do:
db.collection('newUsers').add({
firstName,
lastName,
});
With this rule:
service cloud.firestore {
match /databases/{database}/documents {
match /newUsers {
allow create, update;
}
}
}
How can I add an entry to that collection without being authed?
Upvotes: 2
Views: 56
Reputation: 317392
service cloud.firestore {
match /databases/{database}/documents {
match /newUsers/{user} {
allow create, update if true;
}
}
}
Note that you need to match an actual document, not just a collection. The wildcard {user}
should do this.
Upvotes: 2