From the course: React: Authentication (2021)
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Creating private React routes - React.js Tutorial
From the course: React: Authentication (2021)
Creating private React routes
- [Instructor] All right now that we've got our login and sign up pages completed the next step for our frontend, before we actually start implementing authentication functionality, is for us to add the concept of private routes to our frontend. Basically, what this means is that there are going to be certain pages in our application that we only want authenticated users to be able to see. So in our case, that's just going to be the user info page where we display the user's information. And we don't want unauthenticated users to see this, obviously, because we need to know who the user actually is before we allow them to see and modify their data on the frontend. So as with most things in react, there are several different ways that I've seen to implement private routes. But personally my favorite way is to create a separate private route component. So let's do that. Let's first create a new directory here 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
-
-
-
What is user authentication?6m 27s
-
(Locked)
Basic project setup6m 28s
-
(Locked)
Building a login page8m 54s
-
(Locked)
Building a sign-up page4m 36s
-
(Locked)
Creating private React routes4m 11s
-
JSON Web Token basics9m 22s
-
(Locked)
Adding a sign-up route to the server8m 10s
-
(Locked)
Generating JSON Web Tokens6m 10s
-
(Locked)
Adding a login route to the server6m 59s
-
(Locked)
Implementing JWTs on the front end7m 36s
-
(Locked)
Adding JWTs to sign-up page4m 29s
-
(Locked)
Adding JWTs to login page2m 11s
-
(Locked)
Adding an update user route6m 22s
-
(Locked)
Verifying JSON Web Tokens5m 17s
-
(Locked)
Adding JWTs to the user info page7m 29s
-
(Locked)
Adding logout functionality1m 33s
-
-
-
-
-
-
-