In previous versions of ASP.NET Core, configuring authentication was far more cumbersome and not particularly intuitive. However, with the 2.0 release, Microsoft did a lot of work to refactor how authentication works in ASP.NET Core, and it's now a very simple process to add it to an ASP.NET Core web app.
Adding JWT authentication to the API
Why JWTs?
For standard server-side web applications built with MVC, we'd most likely use cookies rather than JWTs, which is the default option if we don't specify one. However, as we're building a stateless web API with an SPA frontend, it makes much more sense to use JWTs in order to maintain the stateless nature of the application.
In traditional MVC applications...