From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Create new documents with the user connected

Create new documents with the user connected

- [Instructor] Something you want to also enable is to allow automatic sign-in. So we also want to manage users so they can be automatically signed in. So I'm going to add this first in our, so whenever we defined the handler functions for the SDK, right here. And this one I'm going to set up right here, and I'm going to call it, this function, I'm going to call get current user. So we're going to set this one up too, this is going to return also a promise. And basically we're going to do that with the auth objects and call this function, which is on auth state changed. And we're going to pass resolve because whichever results we get from this on auth state change, we're going to pass this like when we return the promise. And let's go back to our context object right here. So we are going to add this one which is authenticate. Now, I want to name it, yeah, it's going to be get current user. And then here, I'm going to name…

Contents