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
Implement Sign in form. Use Basic Authentication to call a GET request from the api. If user is authenticated they will be navigated to /authenticated route.
Resources
- The Authorization request header – MDN
- Base64 encoding and decoding - MDN
- btoa() – MDN
- fetch() - MDN
- useNavigate - React Router
- useRef - React
- .json() - MDN
Treehouse Courses and Workshops
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
In this video, we'll implement
an authorization request header and
0:00
the basic authentication scheme to
authenticate a registered user.
0:01
That way the user can use their
credentials to sign into the app.
0:06
Open up the UserSignIn component.
0:11
When the user submits the sign in form,
0:15
we'll need to send the credentials
to the server in a fetch request, so
0:17
that the server can return to
us the user's information.
0:21
We'll start off by tagging
the handleSubmit function with the async
0:26
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