Join Emmanuel Henri to finalize the project by updating the server with the JSON Web Token.
- [Instructor] Okay so now the final piece … that we need to do is to do the JWT setup … inside of our index. … So let's go into the index file right here … and then what I'm going to do … just Below the bodyParser setup, … it doesn't matter where it is, … I'm going to add the JWT setup. … And this is going to be used to pass a secret word … and then take the headers … and make sure that we match when we get the request … and then pass it down to the controllers. … So let's go ahead and do JWT setup as the common. … And then we're going to do app.use. … And it takes a request, response, and then next. … So we can pass this next function. … And here we go. … So the first thing that we're going to need to do … is make sure that we have headers … which contains the token. … So first make sure that we have headers … and then make sure that we have in the headers … so request.headers.authorization. … And also make sure that in our headers, … and again, so all of this is going to become … very important when we make the request from Postman. …
- Open Web Application Security Project (OWASP)
- Reasons for using a JSON Web Token (JWT)
- Adding bcrypt password hashing
- Adding handlers for registration and login
- Finalizing secured endpoints
- Testing APIs with Postman