In a quick search I realized that my problem with Firebase Authentication is a common problem for many users who have complained for over 2 years! Maybe the complaints weren't clear so I'll try to be detailed in explaining the problem.
I would like to have the same firestore data for the same user regardless of the authentication method used by him. For example email and password, Facebook, Google or GitHub. The only information that is common to all these services is the email address.
I can't use the UserID because firebase creates one for each authentication method.
When creating a security rule so that a user cannot see the data of another, the sentence "request.auth.token.email" is only fed when the "email and password" method is used, generating most of the problems.
Example of rule that doesn't work with google, facebook, etc:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /user/{email}/{documents=**} {
allow read, write, get: if request.auth != null && request.auth.token.email == email;
}
}
}
Could someone from the Firebase team help us?