Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed React Authentication!
You have completed React Authentication!
Preview
I’ll show you how our app will look by the end of this stage.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
You'll often need to
protect certain routes in
0:05
your application from unauthorized users.
0:07
For instance, the authenticated
route would likely display private
0:10
information that we don't want
unauthorized, or logged out users to view.
0:14
In this stage, you'll use React
Router to control what users can and
0:19
cannot view in your application
based on their identity.
0:24
You'll create a routing feature
that allows only logged in users
0:28
to view the authenticated and
settings pages.
0:32
Users who aren't authenticated will
be redirected to the sign in page.
0:35
You'll then provide a smarter,
more efficient login redirect for
0:41
users, so that after logging in,
0:46
the user will be redirected to the
original page they tried navigating to.
0:48
For example, if an unauthorized user
tries to navigate to the Settings page,
0:53
they will be redirected
to the Sign In page.
0:59
But once they sign in, they'll be
redirected back to the Settings page.
1:02
You'll also preserve the user state and
1:07
theme setting across page refreshes by
implementing a cookie that keeps track of,
1:10
or remembers, the authenticated user's
data and settings while logged in.
1:16
You'll learn how to create, read,
update, and delete a cookie.
1:21
Lastly, you'll practice
your refactoring skills
1:26
by creating an errors display component,
and an API helper function.
1:30
These improvements will reduce duplicate
code and enhance maintainability.
1:34
Let's get started.
1:39
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up