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
Now that we have the React application and
express server up and running,
0:04
we can get started on writing
the user registration and
0:09
login functionality with
basic authentication.
0:12
Currently in our app, nothing happens
when a user submits the sign up form or
0:15
the sign in form.
0:20
In this stage, we'll begin working
on a registration component that
0:22
requires a user's name,
username, and password.
0:27
When a user submits the sign up form,
we'll take the form's input values to
0:31
create a new user and send their
credentials to the express server.
0:36
We'll then authenticate a registered
user with basic authentication and
0:40
implement the user sign in.
0:45
For both of these forms,
we'll handle any response from the server.
0:49
For example,
if a user submits a blank sign up form,
0:54
we'll render the list of errors
their server responded with.
0:57
Or in the case of the server being down or
any other error, we'll navigate
1:02
the user to the error route and
display an error message in the console.
1:07
We'll finish the stage off by storing the
authenticated users info in a context so
1:13
that we're able to access
this data from any component.
1:18
We'll display the user's name and
username in the authenticated component,
1:22
and add a welcome message
to the navigation bar.
1:28
Lastly, we'll add some conditional
rendering to our navigation bar to display
1:32
different navigation links, depending
on if the user is authenticated or not.
1:37
Let's get started.
1:42
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