From the course: React: Creating and Hosting a Full-Stack Site

Schalten Sie den kompletten Kurs noch heute frei

Join today to access over 23,400 courses taught by industry experts.

Protecting endpoints using auth-tokens

Protecting endpoints using auth-tokens

"

- Okay. So now that we've added firebase auth to both our front end and our back end it's time to see how to protect our backend endpoints so that users can't do things like add multiple upvotes or add comments without being logged in. So in both of these cases what we're going to need to do is protect our endpoints by basically checking to see whether the client that made the request was logged in or not. Now, the way that we're going to do that as you'll see is if we make a request from inside let's say our article page, in addition to just making our regular request with Axios, we're are also going to need to include something called an authtoken along with this request. Right now, the authtoken is basically just how the front end proves that the user is logged in and that they are who they say they are. So, you know, if you're not familiar with authtokens don't worry too much about it. Just know that these are what…

Inhalt