JWT with ASP.NET Core
April 30, 2018
JSON Web Tokens are convenient ways to do authentication and authorization on the server.
Some of the benefits of JWTs are:
- It can be consumed by a wider range of clients. In fact by any end-point who can understand HTTP (unline cookies which can be consumed mostly only by browsers).
- You only query the database first time to retrieve them and then you keep using them to authenticate as well as authorize the user.
- You can ask 3rd party identity providers to authenticate your users on your behalf and assign tokens to them.
In microservices architecture, you would probably have a separate Authorization service using Identity Server or such.
But .NET core can efficiently handle this task as well.
Let’s explore that.