Microsoft.AspNetCore.Authentication.JwtBearer 10.0.0

About

Microsoft.AspNetCore.Authentication.JwtBearer is a middleware component designed for ASP.NET Core applications. It facilitates JSON Web Token (JWT) authentication, enabling secure authentication for APIs and web services. This package allows you to validate JWT tokens issued by an authentication server, ensuring secure access to your application's resources.

Key Features

  • Seamless integration with ASP.NET Core applications.
  • Supports JSON Web Token (JWT) authentication.
  • Enables secure authentication for APIs and web services.
  • Flexible configuration options for token validation parameters.
  • Works with .NET Core 3.0 and newer, as well as .NET Standard 2.1.

How to Use

using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using System.Text;

public void ConfigureServices(IServiceCollection services)
{
    services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddJwtBearer(options =>
        {
            options.TokenValidationParameters = new TokenValidationParameters
            {
                ValidateIssuer = true,
                ValidateAudience = true,
                ValidateLifetime = true,
                ValidateIssuerSigningKey = true,
                ValidIssuer = "your_issuer",
                ValidAudience = "your_audience",
                IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("your_secret_key"))
            };
        });

    // Other configurations...
}

For more detailed configuration options and advanced scenarios, please refer to the blog JWT Validation and Authorization in ASP.NET Core.

Main Types

The main types provided by this library are:

  • JwtBearerDefaults: Contains default values for JWT Bearer authentication.
  • JwtBearerEvents: Events used to handle JWT Bearer authentication events.
  • JwtBearerHandler: Handles JWT Bearer authentication requests.
  • wtBearerOptions: Options for configuring JWT Bearer authentication.

Additional Documentation

Feedback & Contributing

Microsoft.AspNetCore.Authentication.JwtBearer is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.AspNetCore.Authentication.JwtBearer.

Packages Downloads
IdentityServer4.AccessTokenValidation
ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4
48
IdentityServer4.AccessTokenValidation
ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4
49
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
43
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
44
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
47
Microsoft.AspNetCore.All
Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.
45
Microsoft.AspNetCore.Authentication.AzureAD.UI
ASP.NET Core Azure Active Directory Integration provides components for easily integrating Azure Active Directory authentication within your ASP.NET Core application.
45
Microsoft.AspNetCore.Authentication.AzureAD.UI
ASP.NET Core Azure Active Directory Integration provides components for easily integrating Azure Active Directory authentication within your ASP.NET Core application. This package was built from the source at: https://github.com/aspnet/AADIntegration/tree/1c7e5d489d03b6e11fb529661062d1b4eba62e3a
43
Microsoft.AspNetCore.Authentication.AzureAD.UI
ASP.NET Core Azure Active Directory Integration provides components for easily integrating Azure Active Directory authentication within your ASP.NET Core application. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/440dadc05b2bed38e6a726c2492db90e77d43c62
43
Microsoft.AspNetCore.Authentication.AzureAD.UI
ASP.NET Core Azure Active Directory Integration provides components for easily integrating Azure Active Directory authentication within your ASP.NET Core application. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/d12868dd7c10ff0433c16b06d3b59d03c40d987a
43
Microsoft.AspNetCore.Authentication.AzureAD.UI
ASP.NET Core Azure Active Directory Integration provides components for easily integrating Azure Active Directory authentication within your ASP.NET Core application. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/1d696053fcd6735aaac1902afdb0b92edbf43e71
43
Microsoft.AspNetCore.Authentication.AzureAD.UI
ASP.NET Core Azure Active Directory Integration provides components for easily integrating Azure Active Directory authentication within your ASP.NET Core application. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3eeb12e106b9e913c3a4dec1a7d16da7b74149eb
42
Microsoft.Identity.Web
This package enables ASP.NET Core web apps and web APIs to use the Microsoft identity platform (formerly Azure AD v2.0). This package is specifically used for web applications, which sign-in users, and protected web APIs, which optionally call downstream web APIs.
43
Microsoft.Identity.Web
This package enables ASP.NET Core web apps and web APIs to use the Microsoft identity platform (formerly Azure AD v2.0). This package is specifically used for web applications, which sign-in users, and protected web APIs, which optionally call downstream web APIs.
44
Microsoft.Identity.Web
This package enables ASP.NET Core web apps and web APIs to use the Microsoft identity platform (formerly Azure AD v2.0). This package is specifically used for web applications, which sign-in users, and protected web APIs, which optionally call downstream web APIs.
47
Microsoft.Identity.Web
This package enables ASP.NET Core web apps and web APIs to use the Microsoft identity platform (formerly Azure AD v2.0). This package is specifically used for web applications, which sign-in users, and protected web APIs, which optionally call downstream web APIs.
49
Microsoft.Identity.Web.TokenAcquisition
Implementation for higher level API for confidential client applications (ASP.NET Core and SDK/.NET).
43

Version Downloads Last updated
10.0.0 11 11/12/2025
10.0.0-rc.2.25502.107 11 10/15/2025
10.0.0-rc.1.25451.107 15 09/11/2025
10.0.0-preview.7.25380.108 12 08/14/2025
10.0.0-preview.6.25358.103 14 07/17/2025
10.0.0-preview.5.25277.114 21 06/08/2025
10.0.0-preview.4.25258.110 19 05/15/2025
10.0.0-preview.3.25172.1 20 04/22/2025
10.0.0-preview.2.25164.1 25 03/22/2025
10.0.0-preview.1.25120.3 28 03/09/2025
9.0.11 11 11/13/2025
9.0.10 12 10/15/2025
9.0.9 13 09/11/2025
9.0.8 12 08/06/2025
9.0.7 13 07/10/2025
9.0.6 16 06/12/2025
9.0.5 21 05/16/2025
9.0.4 25 04/19/2025
9.0.3 27 03/18/2025
9.0.2 48 02/21/2025
9.0.1 39 01/17/2025
9.0.0 33 11/14/2024
9.0.0-rc.2.24474.3 27 11/28/2024
9.0.0-rc.1.24452.1 30 12/03/2024
9.0.0-preview.7.24406.2 29 11/23/2024
9.0.0-preview.6.24328.4 21 11/23/2024
9.0.0-preview.5.24306.11 31 12/02/2024
9.0.0-preview.4.24267.6 33 05/25/2024
9.0.0-preview.3.24172.13 35 05/10/2024
9.0.0-preview.2.24128.4 32 04/23/2024
9.0.0-preview.1.24081.5 35 04/24/2024
8.0.22 13 11/13/2025
8.0.21 9 10/15/2025
8.0.20 14 09/11/2025
8.0.19 12 08/06/2025
8.0.18 16 07/10/2025
8.0.17 15 06/12/2025
8.0.16 24 05/16/2025
8.0.15 25 04/19/2025
8.0.14 30 03/18/2025
8.0.13 25 02/18/2025
8.0.12 30 01/17/2025
8.0.11 31 11/14/2024
8.0.10 33 11/04/2024
8.0.8 30 12/02/2024
8.0.7 26 11/29/2024
8.0.6 29 11/29/2024
8.0.5 31 05/31/2024
8.0.4 35 05/03/2024
8.0.3 32 05/10/2024
8.0.2 33 04/29/2024
8.0.1 31 05/31/2024
8.0.0 38 12/18/2023
8.0.0-rc.2.23480.2 35 05/07/2024
8.0.0-rc.1.23421.29 31 05/16/2024
8.0.0-preview.7.23375.9 33 05/31/2024
8.0.0-preview.6.23329.11 33 05/31/2024
8.0.0-preview.5.23302.2 27 05/31/2024
8.0.0-preview.4.23260.4 30 05/10/2024
8.0.0-preview.3.23177.8 26 04/23/2023
8.0.0-preview.2.23153.2 29 05/31/2024
8.0.0-preview.1.23112.2 30 04/22/2024
7.0.20 30 11/18/2024
7.0.19 38 05/14/2024
7.0.18 36 04/24/2024
7.0.17 32 05/10/2024
7.0.16 29 05/05/2024
7.0.15 31 05/06/2024
7.0.14 40 05/10/2024
7.0.13 34 05/31/2024
7.0.12 34 05/08/2024
7.0.11 36 05/02/2024
7.0.10 36 05/10/2024
7.0.9 36 05/31/2024
7.0.8 33 05/20/2024
7.0.7 31 12/18/2023
7.0.5 34 05/31/2024
7.0.4 29 05/06/2024
7.0.3 33 07/13/2023
7.0.2 31 05/07/2024
7.0.1 41 04/26/2024
7.0.0 31 05/31/2024
7.0.0-rc.2.22476.2 33 05/31/2024
7.0.0-rc.1.22427.2 29 05/31/2024
7.0.0-preview.7.22376.6 26 11/23/2024
7.0.0-preview.6.22330.3 24 05/31/2024
7.0.0-preview.5.22303.8 32 05/31/2024
7.0.0-preview.4.22251.1 30 05/25/2024
6.0.36 31 11/18/2024
6.0.35 34 11/14/2024
6.0.33 31 12/01/2024
6.0.32 28 12/05/2024
6.0.31 27 12/03/2024
6.0.30 34 05/14/2024
6.0.29 34 05/10/2024
6.0.28 30 05/07/2024
6.0.27 34 05/10/2024
6.0.26 30 05/31/2024
6.0.25 35 05/10/2024
6.0.24 34 05/01/2024
6.0.23 39 05/03/2024
6.0.22 33 05/02/2024
6.0.21 40 05/10/2024
6.0.20 31 12/02/2024
6.0.19 34 05/16/2024
6.0.18 31 04/24/2024
6.0.16 31 05/01/2024
6.0.15 29 12/03/2024
6.0.14 32 05/31/2024
6.0.13 33 05/03/2024
6.0.12 45 05/07/2023
6.0.11 34 05/05/2024
6.0.10 34 05/01/2024
6.0.9 32 05/06/2024
6.0.8 32 04/26/2024
6.0.7 33 05/31/2024
6.0.6 40 03/22/2023
6.0.5 27 05/31/2024
6.0.0-preview.6.21355.2 30 05/25/2024
5.0.17 35 07/13/2023
5.0.12 40 05/10/2022
5.0.9 30 04/23/2024
5.0.0-rc.1.20451.17 30 05/25/2024
3.1.32 36 04/23/2023
3.1.31 37 05/31/2024
3.1.30 30 10/25/2022
3.1.29 36 04/22/2024
3.1.28 29 05/07/2024
3.1.27 40 05/18/2024
3.1.26 31 04/23/2024
3.1.25 31 05/25/2024
3.1.8 29 05/31/2024
3.1.0 35 05/05/2024
3.0.0 34 02/04/2024
3.0.0-rc1.19457.4 26 05/31/2024
2.3.0 26 01/28/2025
2.1.2 39 05/10/2022
2.0.0-preview2-final 31 05/10/2024
1.0.5 27 05/14/2024