From the course: React: Authentication (2021)
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Implementing JWTs on the front end - React.js Tutorial
From the course: React: Authentication (2021)
Implementing JWTs on the front end
- [Instructor] Okay. So we've created two routes on our backend now for allowing users to create an account and log in with the credentials that they've specified. So now that we have that logic available to us on the backend, it's time to add logic on the front end to integrate JWTs. Now, one way that we could do this would be to simply add that logic directly to our login page and sign up page. But one are the nice things that React allows us to do via hooks is define this logic once, and then simply import it into both our signup and login pages and use it there. You'll see what I mean in just a minute. So the basic idea of what we're going to do here is this. When a user clicks signup, or login, on our respective pages that we have here, both those pages are going to make a request to the corresponding route on the backend, which as we've seen will return a JSON web token containing the user's data. And then what…
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
-
-
-
-
-
-
-