Microsoft.AspNetCore.Authentication.JwtBearer 10.0.0-preview.2.25164.1

Prefix Reserved
This is a prerelease version of Microsoft.AspNetCore.Authentication.JwtBearer.
dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer --version 10.0.0-preview.2.25164.1
                    
NuGet\Install-Package Microsoft.AspNetCore.Authentication.JwtBearer -Version 10.0.0-preview.2.25164.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0-preview.2.25164.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0-preview.2.25164.1" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.AspNetCore.Authentication.JwtBearer --version 10.0.0-preview.2.25164.1
                    
#r "nuget: Microsoft.AspNetCore.Authentication.JwtBearer, 10.0.0-preview.2.25164.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Microsoft.AspNetCore.Authentication.JwtBearer&version=10.0.0-preview.2.25164.1&prerelease
                    
Install Microsoft.AspNetCore.Authentication.JwtBearer as a Cake Addin
#tool nuget:?package=Microsoft.AspNetCore.Authentication.JwtBearer&version=10.0.0-preview.2.25164.1&prerelease
                    
Install Microsoft.AspNetCore.Authentication.JwtBearer as a Cake Tool

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.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2.9K)

Showing the top 5 NuGet packages that depend on Microsoft.AspNetCore.Authentication.JwtBearer:

Package Downloads
Microsoft.Identity.Web.TokenAcquisition

Implementation for higher level API for confidential client applications (ASP.NET Core and SDK/.NET).

Microsoft.AspNetCore.App

Provides a default set of APIs for building an ASP.NET Core application. 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.

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.

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/ab1f1c636afa3a6607f2d67bc387b586596d1d38

Okta.AspNetCore

Official Okta middleware for ASP.NET Core 3.1+. Easily add authentication and authorization to ASP.NET Core applications.

GitHub repositories (423)

Showing the top 5 popular GitHub repositories that depend on Microsoft.AspNetCore.Authentication.JwtBearer:

Repository Stars
bitwarden/server
Bitwarden infrastructure/backend (API, database, Docker, etc).
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
duplicati/duplicati
Store securely encrypted backups in the cloud!
dotnet-architecture/eShopOnWeb
Sample ASP.NET Core 8.0 reference application, now community supported: https://github.com/NimblePros/eShopOnWeb
Version Downloads Last updated
10.0.0-preview.2.25164.1 2,176 3/18/2025
10.0.0-preview.1.25120.3 4,426 2/25/2025
9.0.3 630,138 3/11/2025
9.0.2 1,437,416 2/11/2025
9.0.1 1,582,286 1/14/2025
9.0.0 4,997,298 11/12/2024
9.0.0-rc.2.24474.3 184,766 10/8/2024
9.0.0-rc.1.24452.1 88,767 9/10/2024
9.0.0-preview.7.24406.2 9,232 8/13/2024
9.0.0-preview.6.24328.4 51,940 7/9/2024
9.0.0-preview.5.24306.11 6,002 6/11/2024
9.0.0-preview.4.24267.6 11,761 5/21/2024
9.0.0-preview.3.24172.13 80,170 4/11/2024
9.0.0-preview.2.24128.4 26,374 3/12/2024
9.0.0-preview.1.24081.5 28,360 2/13/2024
8.0.14 519,181 3/11/2025
8.0.13 1,458,279 2/11/2025
8.0.12 2,169,534 1/14/2025
8.0.11 7,078,058 11/12/2024
8.0.10 10,205,702 10/8/2024
8.0.8 12,428,995 8/13/2024
8.0.7 8,811,118 7/9/2024
8.0.6 10,382,318 5/28/2024
8.0.5 3,600,646 5/14/2024
8.0.4 9,207,674 4/9/2024
8.0.3 6,340,563 3/12/2024
8.0.2 7,351,539 2/13/2024
8.0.1 8,662,584 1/9/2024
8.0.0 30,979,354 11/14/2023
8.0.0-rc.2.23480.2 506,490 10/10/2023
8.0.0-rc.1.23421.29 105,054 9/12/2023
8.0.0-preview.7.23375.9 254,892 8/8/2023
8.0.0-preview.6.23329.11 87,129 7/11/2023
8.0.0-preview.5.23302.2 11,946 6/13/2023
8.0.0-preview.4.23260.4 11,669 5/16/2023
8.0.0-preview.3.23177.8 19,458 4/11/2023
8.0.0-preview.2.23153.2 8,995 3/14/2023
8.0.0-preview.1.23112.2 60,482 2/21/2023
7.0.20 1,331,620 5/28/2024
7.0.19 137,945 5/14/2024
7.0.18 420,518 4/9/2024
7.0.17 436,904 3/12/2024
7.0.16 672,657 2/13/2024
7.0.15 1,187,397 1/9/2024
7.0.14 2,320,600 11/14/2023
7.0.13 2,604,865 10/24/2023
7.0.12 2,043,773 10/10/2023
7.0.11 2,937,748 9/12/2023
7.0.10 3,967,523 8/8/2023
7.0.9 2,868,471 7/11/2023
7.0.8 2,365,036 6/22/2023
7.0.7 1,263,342 6/13/2023
7.0.5 7,403,059 4/11/2023
7.0.4 3,609,533 3/14/2023
7.0.3 3,502,945 2/14/2023
7.0.2 4,458,118 1/10/2023
7.0.1 9,403,634 12/13/2022
7.0.0 5,477,944 11/7/2022
7.0.0-rc.2.22476.2 86,300 10/11/2022
7.0.0-rc.1.22427.2 24,696 9/14/2022
7.0.0-preview.7.22376.6 24,748 8/9/2022
7.0.0-preview.6.22330.3 282,805 7/12/2022
7.0.0-preview.5.22303.8 6,298 6/14/2022
7.0.0-preview.4.22251.1 10,469 5/10/2022
7.0.0-preview.3.22178.4 4,466 4/13/2022
7.0.0-preview.2.22153.2 3,979 3/14/2022
7.0.0-preview.1.22109.13 3,438 2/17/2022
6.0.36 692,200 11/12/2024
6.0.35 464,780 10/8/2024
6.0.33 1,341,133 8/13/2024
6.0.32 1,225,404 7/9/2024
6.0.31 1,003,771 5/28/2024
6.0.30 483,865 5/14/2024
6.0.29 1,570,704 4/9/2024
6.0.28 1,239,369 3/12/2024
6.0.27 1,580,214 2/13/2024
6.0.26 2,943,048 1/9/2024
6.0.25 3,674,066 11/14/2023
6.0.24 2,180,082 10/24/2023
6.0.23 1,103,247 10/10/2023
6.0.22 2,071,961 9/12/2023
6.0.21 2,885,502 8/8/2023
6.0.20 2,732,958 7/11/2023
6.0.19 1,769,809 6/22/2023
6.0.18 888,195 6/13/2023
6.0.16 7,412,467 4/11/2023
6.0.15 4,610,637 3/14/2023
6.0.14 4,755,265 2/14/2023
6.0.13 7,620,211 1/10/2023
6.0.12 11,486,500 12/13/2022
6.0.11 8,076,631 11/7/2022
6.0.10 12,185,321 10/11/2022
6.0.9 9,253,511 9/13/2022
6.0.8 11,515,266 8/9/2022
6.0.7 9,337,412 7/12/2022
6.0.6 7,489,933 6/14/2022
6.0.5 10,634,120 5/10/2022
6.0.4 8,421,582 4/11/2022
6.0.3 9,770,013 3/8/2022
6.0.2 7,620,853 2/8/2022
6.0.1 13,199,519 12/14/2021
6.0.0 13,512,791 11/8/2021
6.0.0-rc.2.21480.10 76,184 10/12/2021
6.0.0-rc.1.21452.15 60,714 9/14/2021
6.0.0-preview.7.21378.6 66,681 8/10/2021
6.0.0-preview.6.21355.2 19,521 7/14/2021
6.0.0-preview.5.21301.17 11,777 6/15/2021
6.0.0-preview.4.21253.5 9,963 5/24/2021
6.0.0-preview.3.21201.13 13,815 4/8/2021
6.0.0-preview.2.21154.6 4,015 3/11/2021 6.0.0-preview.2.21154.6 is deprecated because it is no longer maintained.
6.0.0-preview.1.21103.6 6,518 2/12/2021 6.0.0-preview.1.21103.6 is deprecated because it is no longer maintained.
5.0.17 2,851,015 5/10/2022 5.0.17 is deprecated because it is no longer maintained.
5.0.16 661,004 4/11/2022 5.0.16 is deprecated because it is no longer maintained.
5.0.15 1,092,830 3/8/2022 5.0.15 is deprecated because it is no longer maintained.
5.0.14 974,300 2/8/2022 5.0.14 is deprecated because it is no longer maintained.
5.0.13 2,577,499 12/14/2021 5.0.13 is deprecated because it is no longer maintained.
5.0.12 21,265,922 11/7/2021 5.0.12 is deprecated because it is no longer maintained.
5.0.11 3,939,897 10/12/2021 5.0.11 is deprecated because it is no longer maintained.
5.0.10 3,978,673 9/14/2021 5.0.10 is deprecated because it is no longer maintained.
5.0.9 7,554,756 8/10/2021 5.0.9 is deprecated because it is no longer maintained.
5.0.8 2,916,152 7/13/2021 5.0.8 is deprecated because it is no longer maintained; 5.0.8 has at least one vulnerability with moderate severity.
5.0.7 4,192,598 6/8/2021 5.0.7 is deprecated because it is no longer maintained; 5.0.7 has at least one vulnerability with moderate severity.
5.0.6 3,001,105 5/11/2021 5.0.6 is deprecated because it is no longer maintained; 5.0.6 has at least one vulnerability with moderate severity.
5.0.5 4,229,784 4/6/2021 5.0.5 is deprecated because it is no longer maintained; 5.0.5 has at least one vulnerability with moderate severity.
5.0.4 2,998,257 3/9/2021 5.0.4 is deprecated because it is no longer maintained; 5.0.4 has at least one vulnerability with moderate severity.
5.0.3 3,168,105 2/9/2021 5.0.3 is deprecated because it is no longer maintained; 5.0.3 has at least one vulnerability with moderate severity.
5.0.2 2,886,980 1/12/2021 5.0.2 is deprecated because it is no longer maintained; 5.0.2 has at least one vulnerability with moderate severity.
5.0.1 3,216,374 12/8/2020 5.0.1 is deprecated because it is no longer maintained; 5.0.1 has at least one vulnerability with moderate severity.
5.0.0 11,415,122 11/9/2020 5.0.0 is deprecated because it is no longer maintained; 5.0.0 has at least one vulnerability with moderate severity.
5.0.0-rc.2.20475.17 109,012 10/13/2020 5.0.0-rc.2.20475.17 is deprecated because it is no longer maintained.
5.0.0-rc.1.20451.17 314,075 9/14/2020 5.0.0-rc.1.20451.17 is deprecated because it is no longer maintained.
5.0.0-preview.8.20414.8 4,041,417 8/25/2020 5.0.0-preview.8.20414.8 is deprecated because it is no longer maintained.
5.0.0-preview.7.20365.19 16,781 7/21/2020 5.0.0-preview.7.20365.19 is deprecated because it is no longer maintained.
5.0.0-preview.6.20312.15 21,058 6/25/2020 5.0.0-preview.6.20312.15 is deprecated because it is no longer maintained.
5.0.0-preview.5.20279.2 3,559 6/10/2020 5.0.0-preview.5.20279.2 is deprecated because it is no longer maintained.
5.0.0-preview.4.20257.10 4,408 5/18/2020 5.0.0-preview.4.20257.10 is deprecated because it is no longer maintained.
5.0.0-preview.3.20215.14 4,518 4/23/2020 5.0.0-preview.3.20215.14 is deprecated because it is no longer maintained.
5.0.0-preview.2.20167.3 3,585 4/2/2020 5.0.0-preview.2.20167.3 is deprecated because it is no longer maintained.
5.0.0-preview.1.20124.5 5,612 3/16/2020 5.0.0-preview.1.20124.5 is deprecated because it is no longer maintained.
3.1.32 2,499,195 12/13/2022
3.1.31 281,337 11/8/2022
3.1.30 216,443 10/11/2022
3.1.29 266,470 9/13/2022
3.1.28 2,258,699 8/9/2022
3.1.27 372,735 7/12/2022
3.1.26 356,714 6/14/2022
3.1.25 660,955 5/10/2022
3.1.24 478,881 4/11/2022
3.1.23 2,103,469 3/8/2022
3.1.22 3,203,445 12/14/2021
3.1.21 2,248,357 11/7/2021
3.1.20 1,011,942 10/11/2021
3.1.19 1,247,395 9/14/2021
3.1.18 8,244,701 8/10/2021
3.1.17 1,112,354 7/13/2021 3.1.17 has at least one vulnerability with moderate severity.
3.1.16 2,200,004 6/8/2021 3.1.16 has at least one vulnerability with moderate severity.
3.1.15 1,617,668 5/11/2021 3.1.15 has at least one vulnerability with moderate severity.
3.1.14 2,075,456 4/6/2021 3.1.14 has at least one vulnerability with moderate severity.
3.1.13 2,375,368 3/9/2021 3.1.13 has at least one vulnerability with moderate severity.
3.1.12 2,152,241 2/9/2021 3.1.12 has at least one vulnerability with moderate severity.
3.1.11 3,498,870 1/12/2021 3.1.11 has at least one vulnerability with moderate severity.
3.1.10 5,672,616 11/9/2020 3.1.10 has at least one vulnerability with moderate severity.
3.1.9 6,265,756 10/13/2020 3.1.9 has at least one vulnerability with moderate severity.
3.1.8 10,661,241 9/8/2020 3.1.8 has at least one vulnerability with moderate severity.
3.1.7 4,751,460 8/11/2020 3.1.7 has at least one vulnerability with moderate severity.
3.1.6 5,641,354 7/14/2020 3.1.6 has at least one vulnerability with moderate severity.
3.1.5 7,969,535 6/9/2020 3.1.5 has at least one vulnerability with moderate severity.
3.1.4 7,256,950 5/12/2020 3.1.4 has at least one vulnerability with moderate severity.
3.1.3 9,698,142 3/24/2020 3.1.3 has at least one vulnerability with moderate severity.
3.1.2 7,193,307 2/18/2020 3.1.2 has at least one vulnerability with moderate severity.
3.1.1 9,611,303 1/14/2020 3.1.1 has at least one vulnerability with moderate severity.
3.1.0 7,358,187 12/3/2019 3.1.0 has at least one vulnerability with moderate severity.
3.1.0-preview3.19555.2 13,838 11/13/2019 3.1.0-preview3.19555.2 is deprecated because it is no longer maintained; 3.1.0-preview3.19555.2 has at least one vulnerability with moderate severity.
3.1.0-preview2.19528.8 3,495 11/1/2019 3.1.0-preview2.19528.8 is deprecated because it is no longer maintained; 3.1.0-preview2.19528.8 has at least one vulnerability with moderate severity.
3.1.0-preview1.19508.20 7,500 10/15/2019 3.1.0-preview1.19508.20 is deprecated because it is no longer maintained; 3.1.0-preview1.19508.20 has at least one vulnerability with moderate severity.
3.0.3 683,646 2/18/2020 3.0.3 is deprecated because it is no longer maintained; 3.0.3 has at least one vulnerability with moderate severity.
3.0.2 291,002 1/14/2020 3.0.2 is deprecated because it is no longer maintained; 3.0.2 has at least one vulnerability with moderate severity.
3.0.0 41,294,790 9/23/2019 3.0.0 is deprecated because it is no longer maintained; 3.0.0 has at least one vulnerability with moderate severity.
3.0.0-rc1.19457.4 25,173 9/16/2019 3.0.0-rc1.19457.4 is deprecated because it is no longer maintained.
3.0.0-preview9.19424.4 154,210 9/4/2019 3.0.0-preview9.19424.4 is deprecated because it is no longer maintained.
3.0.0-preview8.19405.7 27,985 8/13/2019 3.0.0-preview8.19405.7 is deprecated because it is no longer maintained.
3.0.0-preview7.19365.7 40,279 7/23/2019 3.0.0-preview7.19365.7 is deprecated because it is no longer maintained.
3.0.0-preview6.19307.2 36,844 6/12/2019 3.0.0-preview6.19307.2 is deprecated because it is no longer maintained.
3.0.0-preview5-19227-01 24,315 5/6/2019 3.0.0-preview5-19227-01 is deprecated because it is no longer maintained.
3.0.0-preview4-19216-03 7,116 4/18/2019 3.0.0-preview4-19216-03 is deprecated because it is no longer maintained.
3.0.0-preview3-19153-02 7,849 3/6/2019 3.0.0-preview3-19153-02 is deprecated because it is no longer maintained.
3.0.0-preview-19075-0444 12,487 1/29/2019 3.0.0-preview-19075-0444 is deprecated because it is no longer maintained.
2.3.0 10,207 1/14/2025
2.2.0 29,516,258 12/3/2018 2.2.0 is deprecated because it is no longer maintained.
2.2.0-preview3-35497 71,783 10/17/2018 2.2.0-preview3-35497 is deprecated because it is no longer maintained.
2.2.0-preview2-35157 37,807 9/12/2018 2.2.0-preview2-35157 is deprecated because it is no longer maintained.
2.2.0-preview1-35029 9,093 8/22/2018 2.2.0-preview1-35029 is deprecated because it is no longer maintained.
2.1.30 1,187,517 8/19/2021
2.1.2 17,606,665 8/21/2018 2.1.2 has at least one vulnerability with moderate severity.
2.1.1 12,425,628 6/18/2018 2.1.1 has at least one vulnerability with moderate severity.
2.1.0 15,278,260 5/29/2018 2.1.0 has at least one vulnerability with moderate severity.
2.1.0-rc1-final 41,225 5/6/2018 2.1.0-rc1-final is deprecated because it is no longer maintained.
2.1.0-preview2-final 39,093 4/10/2018 2.1.0-preview2-final is deprecated because it is no longer maintained.
2.1.0-preview1-final 54,128 2/26/2018 2.1.0-preview1-final is deprecated because it is no longer maintained.
2.0.4 4,645,464 5/7/2018 2.0.4 is deprecated because it is no longer maintained.
2.0.3 4,228,681 3/13/2018 2.0.3 is deprecated because it is no longer maintained.
2.0.1 7,592,454 11/14/2017 2.0.1 is deprecated because it is no longer maintained.
2.0.0 12,276,003 8/11/2017 2.0.0 is deprecated because it is no longer maintained.
2.0.0-preview2-final 56,452 6/27/2017 2.0.0-preview2-final is deprecated because it is no longer maintained.
2.0.0-preview1-final 18,169 5/10/2017 2.0.0-preview1-final is deprecated because it is no longer maintained.
1.1.3 487,460 9/20/2017 1.1.3 is deprecated because it is no longer maintained.
1.1.2 1,264,624 5/9/2017 1.1.2 is deprecated because it is no longer maintained.
1.1.1 479,397 3/6/2017 1.1.1 is deprecated because it is no longer maintained.
1.1.0 399,669 11/16/2016 1.1.0 is deprecated because it is no longer maintained.
1.1.0-preview1-final 6,746 10/24/2016 1.1.0-preview1-final is deprecated because it is no longer maintained.
1.0.5 12,934 11/14/2017 1.0.5 is deprecated because it is no longer maintained.
1.0.4 6,869 9/20/2017 1.0.4 is deprecated because it is no longer maintained.
1.0.3 18,995 5/9/2017 1.0.3 is deprecated because it is no longer maintained.
1.0.2 116,973 3/6/2017 1.0.2 is deprecated because it is no longer maintained.
1.0.1 22,018 12/12/2016 1.0.1 is deprecated because it is no longer maintained.
1.0.0 796,015 6/27/2016 1.0.0 is deprecated because it is no longer maintained.
1.0.0-rc2-final 19,741 5/16/2016 1.0.0-rc2-final is deprecated because it is no longer maintained.