The APIs that we created in the last two recipes is public. That means everyone can access and get the information from our server, but what happens if you want to add a security layer on the API and get the information for registered users on your platform? We need to add access token validation to protect our API, and to do this; we have to use JSON Web Tokens (JWT).
Adding access tokens to secure our API
Getting ready
For this recipe, you need to install JWT for Node.js:
npm install jsonwebtoken
How to do it...
We will mostly use the same code that we created for...