From the course: React: Cloud-Powered Apps with Firebase

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

User login

User login

From the course: React: Cloud-Powered Apps with Firebase

Start my 1-month free trial

User login

- We have provided a way for users to sign up and logout, but we now need to provide a way for users to login. Heading back to auth.js, let's implement a login function. This function will also perform asynchronous work. We'll destructure the input to get the email and the password. And we can call it firebase.auth.signInWithEmailAndPassword using the email and password provided. Finally, we can return the user from the response. Let's create a new login page component, which will be very similar to the sign up page. Let's grab the contents of the sign up component and we can paste it here and we can go ahead and delete the first and last name input fields. We can rename the user to simply "user" and instead of sign up, we can call our new login function. We can delete the servants here. We can then change the button text from sign up to login and also provide a way to take the user to the sign up page. Let's create a…

Contents