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.
Authenticated user redirect
From the course: React: Cloud-Powered Apps with Firebase
Authenticated user redirect
- Before wrapping up our work on authentication, we need to address a couple of issues. Let me show you what I mean. Let's go ahead and log in (keyboard clicking) Upon login, I am redirected to the profile page. However, I can still visit both the login page, and also the signup page. In addition, the logout button appears. In this scenario which redirects the user back to the profile page, and not allow them to visit these pages. Let's tackle the SQL. Let's go ahead and create a new folder called router, which will contain all the files we related to routing. We will create a new file call ProfileRedirect.js. This will be a high-order component that will check for a user session and redirect accordingly. This component will render the desired component if there is no user session. Otherwise, it will redirect the user back to the profile page. Let's go ahead and import react from react. We will also import route, and…
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
-
-
-
-
-
-
-