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

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
34
IdentityServer4.AccessTokenValidation
ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4
38
IdentityServer4.AccessTokenValidation
ASP.NET Core authentication handler to validate JWT and reference tokens from IdentityServer4
45
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
34
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
35
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
38
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
39
IdentityServer4.AccessTokenValidation
ASP.NET Core middleware to validate JWT and reference tokens from IdentityServer4
42
Microsoft.AspNetCore.ApiAuthorization.IdentityServer
ASP.NET Core API Authorization package powered by Identity Server. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/371a26f07b23ad77c636332c2dfc0cbd1d8137ba
47
Microsoft.AspNetCore.ApiAuthorization.IdentityServer
ASP.NET Core API Authorization package powered by Identity Server. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/b7a2ec8c7ed6b48857af0a69688a73e8c14fe6cb
46
Microsoft.AspNetCore.ApiAuthorization.IdentityServer
ASP.NET Core API Authorization package powered by Identity Server. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/b92c9f50f0333ea661785ba849f303cde6a93844
37
Microsoft.AspNetCore.ApiAuthorization.IdentityServer
ASP.NET Core API Authorization package powered by Identity Server. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/fc93e595ceffbb1e3e85532bf454e92a6a80dd6b
51
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
161
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/fc93e595ceffbb1e3e85532bf454e92a6a80dd6b
56
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.
35
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.
39
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.
41
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.
51

Version Downloads Last updated
10.0.0-preview.6.25358.103 2 07/18/2025
10.0.0-preview.5.25277.114 4 06/08/2025
10.0.0-preview.4.25258.110 9 05/15/2025
10.0.0-preview.3.25172.1 9 04/13/2025
10.0.0-preview.2.25164.1 11 03/29/2025
10.0.0-preview.1.25120.3 12 03/04/2025
9.0.7 3 07/19/2025
9.0.6 6 06/12/2025
9.0.5 8 05/15/2025
9.0.4 9 04/12/2025
9.0.3 14 03/19/2025
9.0.2 12 03/04/2025
9.0.1 16 01/31/2025
9.0.0 16 11/18/2024
9.0.0-rc.2.24474.3 15 10/12/2024
9.0.0-rc.1.24452.1 16 09/14/2024
9.0.0-preview.7.24406.2 21 08/13/2024
9.0.0-preview.6.24328.4 18 07/13/2024
9.0.0-preview.5.24306.11 16 06/14/2024
9.0.0-preview.4.24267.6 18 05/21/2024
9.0.0-preview.3.24172.13 23 04/12/2024
9.0.0-preview.2.24128.4 29 03/13/2024
9.0.0-preview.1.24081.5 21 03/13/2024
8.0.18 2 07/18/2025
8.0.17 4 06/12/2025
8.0.16 7 05/15/2025
8.0.15 8 04/12/2025
8.0.14 11 03/29/2025
8.0.13 13 02/20/2025
8.0.12 16 01/30/2025
8.0.11 18 11/18/2024
8.0.10 18 10/11/2024
8.0.8 21 08/13/2024
8.0.7 17 08/15/2024
8.0.6 19 05/31/2024
8.0.5 22 05/16/2024
8.0.4 19 04/10/2024
8.0.3 20 03/13/2024
8.0.2 24 03/13/2024
8.0.1 21 02/12/2024
8.0.0 30 02/12/2024
8.0.0-rc.2.23480.2 28 02/12/2024
8.0.0-rc.1.23421.29 23 02/12/2024
8.0.0-preview.7.23375.9 22 02/12/2024
8.0.0-preview.6.23329.11 20 02/12/2024
8.0.0-preview.5.23302.2 25 02/12/2024
8.0.0-preview.4.23260.4 25 02/12/2024
8.0.0-preview.3.23177.8 22 02/12/2024
8.0.0-preview.2.23153.2 23 02/12/2024
8.0.0-preview.1.23112.2 26 02/12/2024
7.0.20 19 05/31/2024
7.0.19 18 05/16/2024
7.0.18 21 04/10/2024
7.0.17 29 03/13/2024
7.0.16 24 03/13/2024
7.0.15 24 02/12/2024
7.0.14 26 02/12/2024
7.0.13 26 02/12/2024
7.0.12 23 01/18/2024
7.0.11 22 02/12/2024
7.0.10 23 02/12/2024
7.0.9 39 02/12/2024
7.0.8 28 02/12/2024
7.0.7 44 02/12/2024
7.0.5 32 04/21/2023
7.0.4 26 02/12/2024
7.0.3 23 02/12/2024
7.0.2 26 02/12/2024
7.0.1 25 02/12/2024
7.0.0 25 02/12/2024
7.0.0-rc.2.22476.2 31 02/12/2024
7.0.0-rc.1.22427.2 27 01/21/2024
7.0.0-preview.7.22376.6 26 02/12/2024
7.0.0-preview.6.22330.3 28 02/12/2024
7.0.0-preview.5.22303.8 25 02/12/2024
7.0.0-preview.4.22251.1 27 02/12/2024
7.0.0-preview.3.22178.4 39 02/12/2024
7.0.0-preview.2.22153.2 22 02/12/2024
7.0.0-preview.1.22109.13 26 02/12/2024
6.0.36 19 11/18/2024
6.0.35 16 10/11/2024
6.0.33 21 08/13/2024
6.0.32 21 07/13/2024
6.0.31 24 05/31/2024
6.0.30 20 05/17/2024
6.0.29 21 04/10/2024
6.0.28 22 03/13/2024
6.0.27 21 03/13/2024
6.0.26 20 02/12/2024
6.0.25 26 02/12/2024
6.0.24 39 02/12/2024
6.0.23 27 01/19/2024
6.0.22 22 02/12/2024
6.0.21 25 02/12/2024
6.0.20 42 02/12/2024
6.0.19 40 02/12/2024
6.0.18 24 02/12/2024
6.0.16 23 02/12/2024
6.0.15 40 02/12/2024
6.0.14 22 02/12/2024
6.0.13 43 02/12/2024
6.0.12 29 02/12/2024
6.0.11 26 02/12/2024
6.0.10 116 10/12/2022
6.0.9 20 02/12/2024
6.0.8 27 02/12/2024
6.0.7 26 02/12/2024
6.0.6 28 06/18/2022
6.0.5 23 02/12/2024
6.0.4 24 02/12/2024
6.0.3 825 03/08/2022
6.0.2 25 02/13/2022
6.0.1 137 01/10/2022
6.0.0 26 01/10/2022
6.0.0-rc.2.21480.10 21 02/12/2024
6.0.0-rc.1.21452.15 22 02/12/2024
6.0.0-preview.7.21378.6 27 02/12/2024
6.0.0-preview.6.21355.2 24 02/12/2024
6.0.0-preview.5.21301.17 22 02/12/2024
6.0.0-preview.4.21253.5 25 02/12/2024
6.0.0-preview.3.21201.13 26 02/12/2024
6.0.0-preview.2.21154.6 34 02/12/2024
6.0.0-preview.1.21103.6 27 02/12/2024
5.0.17 21 02/12/2024
5.0.16 25 02/12/2024
5.0.15 40 02/12/2024
5.0.14 30 02/12/2024
5.0.13 19 02/12/2024
5.0.12 54 12/15/2021
5.0.11 21 02/12/2024
5.0.10 52 10/05/2021
5.0.9 26 09/09/2021
5.0.8 26 07/13/2021
5.0.7 23 02/12/2024
5.0.6 22 05/11/2021
5.0.5 45 04/06/2021
5.0.4 25 03/29/2021
5.0.3 27 02/09/2021
5.0.2 34 01/26/2021
5.0.1 90 12/10/2020
5.0.0 51 11/12/2020
5.0.0-rc.2.20475.17 25 02/12/2024
5.0.0-rc.1.20451.17 22 02/12/2024
5.0.0-preview.8.20414.8 24 02/12/2024
5.0.0-preview.7.20365.19 26 02/12/2024
5.0.0-preview.6.20312.15 26 02/12/2024
5.0.0-preview.5.20279.2 23 02/12/2024
5.0.0-preview.4.20257.10 21 02/12/2024
5.0.0-preview.3.20215.14 20 01/25/2024
5.0.0-preview.2.20167.3 24 02/12/2024
5.0.0-preview.1.20124.5 24 02/12/2024
3.1.32 18 02/12/2024
3.1.31 20 02/12/2024
3.1.30 20 02/12/2024
3.1.29 24 02/12/2024
3.1.28 23 02/12/2024
3.1.27 24 02/08/2024
3.1.26 19 02/12/2024
3.1.25 24 02/12/2024
3.1.24 25 02/12/2024
3.1.23 45 02/12/2024
3.1.22 79 12/14/2021
3.1.21 21 02/12/2024
3.1.20 24 02/12/2024
3.1.19 23 02/12/2024
3.1.18 24 02/12/2024
3.1.17 39 07/13/2021
3.1.16 31 06/08/2021
3.1.15 26 05/11/2021
3.1.14 24 04/06/2021
3.1.13 55 03/09/2021
3.1.12 273 02/11/2021
3.1.11 24 01/25/2021
3.1.10 26 11/10/2020
3.1.9 146 10/25/2020
3.1.8 73 03/30/2021
3.1.7 26 08/25/2020
3.1.6 35 02/12/2024
3.1.5 32 06/11/2020
3.1.4 23 02/12/2024
3.1.3 25 02/12/2024
3.1.2 20 02/12/2024
3.1.1 18 02/12/2024
3.1.0 23 08/25/2020
3.1.0-preview3.19555.2 21 02/12/2024
3.1.0-preview2.19528.8 23 02/12/2024
3.1.0-preview1.19508.20 21 02/12/2024
3.0.3 21 02/12/2024
3.0.2 25 02/12/2024
3.0.0 25 02/24/2020
3.0.0-rc1.19457.4 21 02/12/2024
3.0.0-preview9.19424.4 25 02/12/2024
3.0.0-preview8.19405.7 22 02/12/2024
3.0.0-preview7.19365.7 20 02/12/2024
3.0.0-preview6.19307.2 23 02/12/2024
3.0.0-preview5-19227-01 26 02/12/2024
3.0.0-preview4-19216-03 28 02/12/2024
3.0.0-preview3-19153-02 21 02/12/2024
3.0.0-preview-19075-0444 38 02/12/2024
2.3.0 15 01/31/2025
2.2.0 25 12/03/2020
2.2.0-preview3-35497 21 02/12/2024
2.2.0-preview2-35157 23 02/12/2024
2.2.0-preview1-35029 23 02/12/2024
2.1.30 29 10/08/2021
2.1.2 36 06/20/2023
2.1.1 25 02/12/2024
2.1.0 26 02/17/2021
2.1.0-rc1-final 22 02/12/2024
2.1.0-preview2-final 32 02/12/2024
2.1.0-preview1-final 29 02/12/2024
2.0.4 20 02/12/2024
2.0.3 23 02/12/2024
2.0.1 28 02/12/2024
2.0.0 22 02/12/2024
2.0.0-preview2-final 27 02/12/2024
2.0.0-preview1-final 23 02/12/2024
1.1.3 23 02/12/2024
1.1.2 40 02/12/2024
1.1.1 22 02/12/2024
1.1.0 23 02/12/2024
1.1.0-preview1-final 25 02/12/2024
1.0.5 21 02/12/2024
1.0.4 24 02/12/2024
1.0.3 23 02/12/2024
1.0.2 25 01/20/2024
1.0.1 23 02/12/2024
1.0.0 38 02/12/2024
1.0.0-rc2-final 23 01/04/2024