Summary
Until now, one of the main issues we had with our application is that we didn't have any authentication. We can now tell who is logged in every time a user accesses our application. This allows us to secure the GraphQL API and insert new posts or messages into the name of the correct user. In this chapter, we discussed the fundamental aspects of JWTs, localStorage
, and cookies. We also looked at how hashed password verification and signed tokens work. We then covered how to implement JWTs inside React and how to trigger the correct events to log in and log out.
In the next chapter, we are going to implement image uploads with a reusable component that allows the user to upload new avatar images.