How to use JWT tokens in ASP.Net Core 2

Take advantage of JSON Web Tokens to implement a loosely coupled security model in your ASP.Net Core applications

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

ASP.Net Core is an open source, cross-platform, lean, and modular framework for building high-performance web applications. Unlike earlier versions of the framework, ASP.Net Core 2 provides support for JSON Web Tokens. In this article, we’ll draw on ASP.Net Core 2.x to see how JWT tokens can be used in a typical ASP.Net Core web application.

What are JWT tokens?

JSON Web Tokens (or JWTs for short) are very popular in the web development community these days. JWT is an open standard in which the sender and receiver can communicate via JSON in a secure manner. JWT tokens are typically used for authenticating and authorizing users. JWT tokens are comprised of three parts:

  1. Header —provides metadata about the type of data and the algorithm used to encrypt the data being transferred
  2. Payload—the actual data represented in JSON format
  3. Signature—used to validate the integrity of the data being transferred

Create a new ASP.Net Core project

To continue reading this article register now