Microsoft.AspNetCore.Authentication.JwtBearer 9.0.0-rc.2.24474.3

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/cf2c5c9c6dca430b97aa96429b84d0da07eb77f1
51
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
50
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
49
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
48
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
48
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
48
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.
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/aspnet/AspNetCore/tree/0a2e366eaf4d29b24b9a98e5782a04bef573189e
45
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/80fec4e3edea3972e95885f5c0db6ee06072f917
45
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
45
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
45
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
45
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/0bc3c376f0cd14335e8b3afca69596acabeb1f80
44
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/e77cb01b5529c137130757859f09f892dbdd2436
44
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/5a007deadbb2636caff4656333cafc818b6b2ef6
44
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/d4a83b27a44c35c521600e1f30ef688c874415d4
44
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
44
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/4768f164d522e128f91827810527730f7468fd74
43
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
43
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/330c2397160929d6d3275ade03cee436265258e8
43

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