In the previous section, we covered how to use basic authentication with the RESTful web service. This method cannot be used when we develop our own frontend with React, so we are going to use JSON Web Token (JWT) authentication instead. JWT is a compact way to implement authentication in modern web applications. JWT is really small in size and can therefore be sent in the URL, in the POST parameter, or inside the header. It also contains all the necessary information pertaining to the user.
The JSON web token contains three different parts, separated by dots:
- The first part is the header that defines the type of the token and the hashing algorithm.
- The second part is the payload that, typically, in the case ...