f-miyu / Plugin.FirebaseAuth

MIT License
61 stars 26 forks source link

How do we Integrate this with Plugin.CloudFirestore ? #8

Open lusanney opened 5 years ago

lusanney commented 5 years ago

Hi, how can we attach UID of a user to a Firestore request? Considering this code:

// Load all documents from Cloud Firestore
var query = await CrossCloudFirestore.Current
                                     .Instance
                                     .GetCollection("User")
                                     .GetDocumentsAsync();

// Convert to List of User Model
var UsersList = query.ToObjects<User>().ToList();
devopsoftware commented 4 years ago

I am also looking for this solution. Anyone able to achieve this?

ghost commented 4 years ago

In my experience this happens automatically if you logged in with firebase. Check the rules on the database on firebase console.

RichardSV15 commented 4 years ago

I do it like this: var mAuth = await CrossFirebaseAuth.Current.Instance .SignInWithEmailAndPasswordAsync(Email, Password); if (mAuth.User.Uid != null){ //Save UID to settings and use it anywhere in your project }