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

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
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/aspnet/AspNetCore/tree/aee5e4080331553ea9dfb7fb388b6d72f715bf6a
59
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/aspnet/AspNetCore/tree/509f6badec2f3162f0e50330cd9107e5624b379b
58
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/aspnet/AspNetCore/tree/cf2c5c9c6dca430b97aa96429b84d0da07eb77f1
58
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/aspnet/AspNetCore/tree/c5f85986e62dabfc0b7f2f2a45dc7c22e8ac815f
57
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/55738ff96b832439076e25584cfe0eb3bace9b01
57
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/68bb6fb08f8f85bb3cf08953a0d2f4a254eaccff
57
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.
57
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/f6897a5bb7ca767df8eb465bf15b193c878fffbf
56
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/70048beee894074e9718206a0017d9b080ee66ff
56
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.
55
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/25bd01f17d5f01fc78bea5eb5308b2c0d79e2889
54
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/c0ae1d179dba6f3acd0e55be55718c97c9028698
54
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/febee99db845fd8766a13bdb391a07c3ee90b4ba
54
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.
54
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/aspnet/AspNetCore/tree/2e51a0b6eba74bdf02aee71944e973487937cb99
53
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. This package was built from the source at: https://github.com/aspnet/Universe/tree/244e037a222a7cd0a17feafb7f3a625fde40de97
53
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/fb4b5a21ebd67b31fff4ddf5c039181da504c932
53
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/39e0501ee91dcf2b9b885d647795184815fb0408
53
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/aspnet/AspNetCore/tree/bd1e14b7d16b798de8a874189c89afed755a266c
52
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/d827c653b787c07de908240b7746ce34d3e6271e
52

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