firebase-security

Firebase rules when user log out 'Missing or insufficient permissions. Error: Missing or insufficient permissions'

孤街醉人 提交于 2021-01-20 12:53:45
问题 Error : 'Error with profile listener: Missing or insufficient permissions. Error: Missing or insufficient permissions.' My app is a project manager built using Reactjs, Redux, Firebase. Could you tell me why it gives this error when the user logs out and how to solve it? My rules: service cloud.firestore { match /databases/{database}/documents { // Match any {project} document in the 'projects' collection match /projects/{project} { // Allow signed in users to read write projects allow read,

Firestore Security Rules allow specific field only [duplicate]

為{幸葍}努か 提交于 2021-01-20 11:27:33
问题 This question already has answers here : How to allow only particular fields of a firestore document to be accessed publicly (1 answer) Can I restrict certain fields in firestore database to be only fetched by firebase admin? (2 answers) Closed 6 months ago . I am trying to implement security rule to limit users to access only specific fields inside a document. My data structure goes like this: document { name: John, dob: 1994, email: john@hotmail.com } I want to limit the name field to read,

Firestore rule succeeds in Playground and client but returns Permissions Denied using get method

走远了吗. 提交于 2021-01-07 02:56:54
问题 I have only one match statement and it is set to pass if the collection or document path is in the the user's permissions.read array. I'm only testing user u1 which has a permissions.read property. match /{document=**} { allow read: if document in get(/databases/$(database)/documents/users/$(request.auth.uid)).data.permissions.read; } I get the following responses when requesting the collection /companies/c1/departments/d1/employee or the document /companies/c1/departments/d1/employees/e1

Firestore Security Rules: Allow User To Create Doc Only If New Doc ID is same as User ID

巧了我就是萌 提交于 2020-12-25 00:03:26
问题 When users log in for the first time, I need to also call a function that creates a document in my firestore users collection to store their profile data. Using Web SDK. (I was previously using a new user triggered event with firebase functions, but it was too slow to wait for a cold function to spin up). Security Rule Requirements Needs to ensure that the user can only create a document if the document id is the same as their user id (to prevent the user from creating other docs). Needs to

Firestore Security Rules: Allow User To Create Doc Only If New Doc ID is same as User ID

让人想犯罪 __ 提交于 2020-12-25 00:01:44
问题 When users log in for the first time, I need to also call a function that creates a document in my firestore users collection to store their profile data. Using Web SDK. (I was previously using a new user triggered event with firebase functions, but it was too slow to wait for a cold function to spin up). Security Rule Requirements Needs to ensure that the user can only create a document if the document id is the same as their user id (to prevent the user from creating other docs). Needs to

Uploading files to user specific directories in firebase storage for android?

爷,独闯天下 提交于 2020-12-23 12:45:48
问题 I am trying to upload a file using firebase storage in Android. But i am receiving the following exception: E/StorageException: StorageException has occurred. User does not have permission to access this object. Code: -13021 HttpResult: 403 E/StorageException: The server has terminated the upload session java.io.IOException: The server has terminated the upload session at com.google.firebase.storage.UploadTask.zzs(Unknown Source) at com.google.firebase.storage.UploadTask.zzr(Unknown Source)

Uploading files to user specific directories in firebase storage for android?

时间秒杀一切 提交于 2020-12-23 12:44:10
问题 I am trying to upload a file using firebase storage in Android. But i am receiving the following exception: E/StorageException: StorageException has occurred. User does not have permission to access this object. Code: -13021 HttpResult: 403 E/StorageException: The server has terminated the upload session java.io.IOException: The server has terminated the upload session at com.google.firebase.storage.UploadTask.zzs(Unknown Source) at com.google.firebase.storage.UploadTask.zzr(Unknown Source)

nested firebase-firestore rules: owner id within parent document

隐身守侯 提交于 2020-12-16 03:50:51
问题 I can't get these rules to work: I've got a collection with projects, which all have an owner. The owner should be allowed to read/write his projects and the subcollection working_copies as well. This implementation succesfully grants reading the project, but fails ( Missing or insufficient permissions ) when reading a working_copy from the sub collection. I suspect it tries to find an owner within the sub-document. service cloud.firestore { match /databases/{database}/documents { match

nested firebase-firestore rules: owner id within parent document

放肆的年华 提交于 2020-12-16 03:50:18
问题 I can't get these rules to work: I've got a collection with projects, which all have an owner. The owner should be allowed to read/write his projects and the subcollection working_copies as well. This implementation succesfully grants reading the project, but fails ( Missing or insufficient permissions ) when reading a working_copy from the sub collection. I suspect it tries to find an owner within the sub-document. service cloud.firestore { match /databases/{database}/documents { match

Firebase UID vs document-id and Firestore Rules

本秂侑毒 提交于 2020-12-12 11:35:07
问题 Hi I am getting a little bit confused here with Firebase User UID and Firestore Document ID (userId???)... and looking for some help :-) By creating a user I get a UID and I write it to the database let db = Firestore.firestore() db.collection("user").addDocument(data: [ "name": "confused", "uid": result!.uid ]) by doing so I get a unique document-id (marked green) which I thought is the userId as well: The thing I wanted to achieve is that the user can only read and write his document (green