![]() |
VOOZH | about |
dotnet add package Auth0.AspNetCore.Authentication --version 1.7.1
NuGet\Install-Package Auth0.AspNetCore.Authentication -Version 1.7.1
<PackageReference Include="Auth0.AspNetCore.Authentication" Version="1.7.1" />
<PackageVersion Include="Auth0.AspNetCore.Authentication" Version="1.7.1" />Directory.Packages.props
<PackageReference Include="Auth0.AspNetCore.Authentication" />Project file
paket add Auth0.AspNetCore.Authentication --version 1.7.1
#r "nuget: Auth0.AspNetCore.Authentication, 1.7.1"
#:package Auth0.AspNetCore.Authentication@1.7.1
#addin nuget:?package=Auth0.AspNetCore.Authentication&version=1.7.1Install as a Cake Addin
#tool nuget:?package=Auth0.AspNetCore.Authentication&version=1.7.1Install as a Cake Tool
A library based on Microsoft.AspNetCore.Authentication.OpenIdConnect to make integrating Auth0 in your ASP.NET Core application as seamlessly as possible.
đ Release
đ Downloads
đ License
đ Build and Test
đ Documentation - đ Getting Started - đģ API Reference - đŦ Feedback
This library supports .NET 6.0, 7.0, 8.0, and 10.0.
The SDK is available on Nuget and can be installed through the UI or using the Package Manager Console:
Install-Package Auth0.AspNetCore.Authentication
Create a Regular Web Application in the Auth0 Dashboard.
If you're using an existing application, verify that you have configured the following settings in your Regular Web Application:
- Click on the "Settings" tab of your application's page.
- Scroll down and click on "Advanced Settings".
- Under "Advanced Settings", click on the "OAuth" tab.
- Ensure that "JSON Web Token (JWT) Signature Algorithm" is set to
RS256and that "OIDC Conformant" is enabled.
Next, configure the following URLs for your application under the "Application URIs" section of the "Settings" page:
https://YOUR_APP_DOMAIN:YOUR_APP_PORT/callbackhttps://YOUR_APP_DOMAIN:YOUR_APP_PORT/Take note of the Client ID, Client Secret, and Domain values under the "Basic Information" section. You'll need these values to configure your ASP.NET web application.
âšī¸ You need the Client Secret only when you have to get an access token to call an API.
To make your ASP.NET web application communicate properly with Auth0, you need to add the following configuration section to your appsettings.json file:
"Auth0": {
"Domain": "YOUR_AUTH0_DOMAIN",
"ClientId": "YOUR_AUTH0_CLIENT_ID"
}
Replace the placeholders with the proper values from the Auth0 Dashboard.
Make sure you have enabled authentication and authorization in your Startup.Configure method:
...
app.UseAuthentication();
app.UseAuthorization();
...
Integrate the SDK in your ASP.NET Core application by calling AddAuth0WebAppAuthentication in your Startup.ConfigureServices method:
services.AddAuth0WebAppAuthentication(options =>
{
options.Domain = Configuration["Auth0:Domain"];
options.ClientId = Configuration["Auth0:ClientId"];
});
Triggering login or logout is done using ASP.NET's HttpContext:
public async Task Login(string returnUrl = "/")
{
var authenticationProperties = new LoginAuthenticationPropertiesBuilder()
.WithRedirectUri(returnUrl)
.Build();
await HttpContext.ChallengeAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);
}
[Authorize]
public async Task Logout()
{
var authenticationProperties = new LogoutAuthenticationPropertiesBuilder()
// Indicate here where Auth0 should redirect the user after a logout.
// Note that the resulting absolute Uri must be added in the
// **Allowed Logout URLs** settings for the client.
.WithRedirectUri(Url.Action("Index", "Home"))
.Build();
await HttpContext.SignOutAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
}
For more code samples on how to integrate the auth0-aspnetcore-authentication SDK in your ASP.NET MVC application, have a look at our examples.
This SDK also works with Blazor Server, for more info see the Blazor Server section in our examples.
Multiple Custom Domains (MCD) lets you resolve the Auth0 domain per request while keeping a single SDK instance. This is useful when one application serves multiple custom domains (for example, brand-1.my-app.com and brand-2.my-app.com), each mapped to a different Auth0 custom domain.
Resolver mode is intended for the custom domains of a single Auth0 tenant. It is not a supported way to connect multiple Auth0 tenants to one application.
services.AddAuth0WebAppAuthentication(options =>
{
options.Domain = Configuration["Auth0:Domain"];
options.ClientId = Configuration["Auth0:ClientId"];
})
.WithCustomDomains(options =>
{
// Example: resolve from a custom header
options.DomainResolver = httpContext =>
{
var tenant = httpContext.Request.Headers["X-Tenant-Domain"].FirstOrDefault();
return Task.FromResult(tenant ?? "default-tenant.auth0.com");
};
});
For detailed configuration options, caching strategies, security requirements, and more examples, see the .
Explore public API's available in auth0-aspnetcore-authentication.
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
To provide feedback or report a bug, please raise an issue on our issue tracker.
Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
<p align="center"> <picture> <source media="(prefers-color-scheme: light)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150"> <source media="(prefers-color-scheme: dark)" srcset="https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png" width="150"> <img alt="Auth0 Logo" src="https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png" width="150"> </picture> </p> <p align="center">Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout <a href="https://auth0.com/why-auth0">Why Auth0?</a></p> <p align="center"> This project is licensed under the MIT license. See the <a href="https://github.com/auth0/auth0-aspnetcore-authentication/blob/main/LICENSE">LICENSE</a> file for more info.</p>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Auth0.AspNetCore.Authentication:
| Package | Downloads |
|---|---|
|
Hood.Core
Package Description |
|
|
Corner49.Infra
An opinionated set of infrastructure libraries for .Net applications |
|
|
Lyte.Libraries.Web.Mvc
Lyte Web MVC Library |
|
|
DBN.Auth.Auth0
.NET library for easy Auth0 integration |
|
|
STZ.Frontend
Package Description |
Showing the top 2 popular GitHub repositories that depend on Auth0.AspNetCore.Authentication:
| Repository | Stars |
|---|---|
|
davidfowl/TodoApp
Todo application with ASP.NET Core Blazor WASM, Minimal APIs and Authentication
|
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.7.1 | 13,109 | 6/8/2026 |
| 1.7.0 | 131,602 | 4/9/2026 |
| 1.6.1 | 232,770 | 12/22/2025 |
| 1.6.0 | 41,149 | 12/5/2025 |
| 1.5.1 | 114,654 | 11/7/2025 |
| 1.5.0 | 252,448 | 7/21/2025 |
| 1.4.1 | 1,741,890 | 1/25/2024 |
| 1.4.0 | 153,212 | 12/5/2023 |
| 1.3.1 | 229,877 | 7/19/2023 |
| 1.3.0 | 25,833 | 7/14/2023 |
| 1.2.0 | 230,241 | 3/10/2023 |
| 1.1.0 | 150,295 | 1/17/2023 |
| 1.0.4 | 168,032 | 9/19/2022 |
| 1.0.3 | 128,184 | 5/12/2022 |
| 1.0.2 | 16,751 | 5/6/2022 |
| 1.0.1 | 173,548 | 2/15/2022 |
| 1.0.0 | 188,828 | 10/14/2021 |
| 1.0.0-beta.1 | 734 | 9/16/2021 |