Microsoft.AspNetCore.Authentication.OpenIdConnect 10.0.0

About

Microsoft.AspNetCore.Authentication.OpenIdConnect provides middleware that enables an application to support the OpenID Connect authentication workflow.

Key Features

  • Single sign-on and single sign-out support
  • Integration with external identity providers
  • Token validation and management
  • Configuration and mapping of user claims

How to Use

To use Microsoft.AspNetCore.Authentication.OpenIdConnect, follow these steps:

Installation

dotnet add package Microsoft.AspNetCore.Authentication.OpenIdConnect

Configuration

To configure Microsoft.AspNetCore.Authentication.OpenIdConnect, you need to add the necessary services and middleware to your application.

  1. In the Program.cs of your ASP.NET Core app, add the following code to register the OpenID Connect authentication services:

    builder.Services
        .AddAuthentication(options =>
        {
            options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
        })
        .AddCookie()
        .AddOpenIdConnect(options =>
        {
            // Configure the authentication options
            options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
            options.Authority = "your-identity-provider";
            options.ClientId = "your-client-id";
            options.ClientSecret = "your-client-secret-from-user-secrets-or-keyvault";
            options.ResponseType = "code";
            options.Scope.Add("profile");
            options.SaveTokens = true;
        });
    

    Make sure to replace your-identity-provider, your-client-id, and your-client-secret-from-user-secrets-or-keyvault, with the appropriate values for your application and identity provider.

  2. Add the following code to enable the OpenID Connect authentication middleware:

    var app = builder.Build();
    
    app.UseAuthentication();
    

    This ensures that the authentication middleware is added to the request pipeline.

Main Types

The main types provided by Microsoft.AspNetCore.Authentication.OpenIdConnect are:

  • OpenIdConnectOptions: Represents the options for configuring the OpenID Connect authentication middleware
  • OpenIdConnectEvents: Provides event handlers for various stages of the OpenID Connect authentication workflow

For more information on these types and their usage, refer to the official documentation.

Additional Documentation

For additional documentation on using OpenID Connect authentication in ASP.NET Core, you can refer to the following resources:

Feedback & Contributing

Microsoft.AspNetCore.Authentication.OpenIdConnect 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.OpenIdConnect.

Packages Downloads
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
184
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
86
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
79
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
76
Microsoft.AspNetCore.Diagnostics.Identity.Service
ASP.NET Core Identity Service Diagnostics Middleware.
76
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
72
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
71
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
71
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
70
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
69
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
68
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.
68
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
67
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
67
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
66
IdentityServer4
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
66
Duende.IdentityServer
OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
65

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