From the course: React: Cloud-Powered Apps with Firebase
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Firebase Authentication setup3m 20s
-
Creating users6m 57s
-
(Locked)
Displaying current user7m 17s
-
(Locked)
Redirect user upon signup2m 30s
-
(Locked)
User logout3m 55s
-
(Locked)
User login4m 56s
-
(Locked)
Authenticated user redirect4m 38s
-
(Locked)
Challenge: Authentication redirect2m 30s
-
(Locked)
Solution: Authentication redirect2m 2s
-
-
-
-
-
-
-