{"id":14989842,"url":"https://github.com/auth0/auth0-aspnetcore-authentication","last_synced_at":"2026-04-09T11:15:54.804Z","repository":{"id":38824282,"uuid":"357539301","full_name":"auth0/auth0-aspnetcore-authentication","owner":"auth0","description":"SDK for integrating Auth0 in ASPNET Core","archived":false,"fork":false,"pushed_at":"2025-03-19T05:30:09.000Z","size":7782,"stargazers_count":98,"open_issues_count":1,"forks_count":38,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-05-08T21:34:41.698Z","etag":null,"topics":["asp-net","auth0","authentication","dotnet","dx-sdk","oidc"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-13T12:09:32.000Z","updated_at":"2025-04-15T12:25:31.000Z","dependencies_parsed_at":"2023-02-13T21:31:03.813Z","dependency_job_id":"6686175f-1d51-4089-89ea-66d12464af85","html_url":"https://github.com/auth0/auth0-aspnetcore-authentication","commit_stats":{"total_commits":120,"total_committers":14,"mean_commits":8.571428571428571,"dds":"0.30833333333333335","last_synced_commit":"0032a7b821db44613c0ea2b7432fca50101e59d2"},"previous_names":["auth0/auth0-aspnetcore-mvc"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-aspnetcore-authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-aspnetcore-authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-aspnetcore-authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fauth0-aspnetcore-authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0","download_url":"https://codeload.github.com/auth0/auth0-aspnetcore-authentication/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355335,"owners_count":22057354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net","auth0","authentication","dotnet","dx-sdk","oidc"],"created_at":"2024-09-24T14:19:00.651Z","updated_at":"2026-04-09T11:15:54.771Z","avatar_url":"https://github.com/auth0.png","language":"C#","readme":"![Auth0 SDK for ASP.NET Core applications](https://cdn.auth0.com/website/sdks/banners/auth0-aspnetcore-authentication-banner.png)\n\nA library based on `Microsoft.AspNetCore.Authentication.OpenIdConnect` to make integrating Auth0 in your ASP.NET Core application as seamlessly as possible.\n\n![Release](https://img.shields.io/github/v/release/auth0/auth0-aspnetcore-authentication)\n![Downloads](https://img.shields.io/nuget/dt/auth0.aspnetcore.authentication)\n[![License](https://img.shields.io/:license-MIT-blue.svg?style=flat)](https://opensource.org/licenses/MIT)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/auth0/auth0-aspnetcore-authentication)\n[![Build and Test](https://github.com/auth0/auth0-aspnetcore-authentication/actions/workflows/build.yml/badge.svg)](https://github.com/auth0/auth0-aspnetcore-authentication/actions/workflows/build.yml)\n\n:books: [Documentation](#documentation) - :rocket: [Getting Started](#getting-started) - :computer: [API Reference](#api-reference) - :speech_balloon: [Feedback](#feedback)\n\n## Documentation\n\n- [Quickstart](https://auth0.com/docs/quickstart/webapp/aspnet-core) - our interactive guide for quickly adding login, logout and user information to an ASP.NET MVC application using Auth0.\n- [Sample App](https://github.com/auth0-samples/auth0-aspnetcore-mvc-samples/tree/master/Quickstart/Sample) - a full-fledged ASP.NET MVC application integrated with Auth0.\n- [Examples](https://github.com/auth0/auth0-aspnetcore-authentication/blob/main/EXAMPLES.md) - code samples for common ASP.NET MVC authentication scenario's.\n- [Docs site](https://www.auth0.com/docs) - explore our docs site and learn more about Auth0. \n\n## Getting started\n### Requirements\n\nThis library supports .NET 6.0, 7.0, 8.0, and 10.0.\n\n### Installation\n\nThe SDK is available on [Nuget](https://www.nuget.org/packages/Auth0.AspNetCore.Authentication) and can be installed through the UI or using the Package Manager Console:\n\n```\nInstall-Package Auth0.AspNetCore.Authentication\n```\n\n### Configure Auth0\n\nCreate a **Regular Web Application** in the [Auth0 Dashboard](https://manage.auth0.com/#/applications).\n\n\u003e **If you're using an existing application**, verify that you have configured the following settings in your Regular Web Application:\n\u003e\n\u003e - Click on the \"Settings\" tab of your application's page.\n\u003e - Scroll down and click on \"Advanced Settings\".\n\u003e - Under \"Advanced Settings\", click on the \"OAuth\" tab.\n\u003e - Ensure that \"JSON Web Token (JWT) Signature Algorithm\" is set to `RS256` and that \"OIDC Conformant\" is enabled.\n\nNext, configure the following URLs for your application under the \"Application URIs\" section of the \"Settings\" page:\n\n- **Allowed Callback URLs**: `https://YOUR_APP_DOMAIN:YOUR_APP_PORT/callback`\n- **Allowed Logout URLs**: `https://YOUR_APP_DOMAIN:YOUR_APP_PORT/`\n\nTake 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.\n\n\u003e :information_source: You need the **Client Secret** only when you have to get an access token to [call an API](#calling-an-api).\n\n### Configure the SDK\n\nTo make your ASP.NET web application communicate properly with Auth0, you need to add the following configuration section to your `appsettings.json` file:\n\n```json\n  \"Auth0\": {\n    \"Domain\": \"YOUR_AUTH0_DOMAIN\",\n    \"ClientId\": \"YOUR_AUTH0_CLIENT_ID\"\n  }\n```\n\nReplace the placeholders with the proper values from the Auth0 Dashboard.\n\nMake sure you have enabled authentication and authorization in your `Startup.Configure` method:\n\n```csharp\n...\napp.UseAuthentication();\napp.UseAuthorization();\n...\n```\n\nIntegrate the SDK in your ASP.NET Core application by calling `AddAuth0WebAppAuthentication` in your `Startup.ConfigureServices` method:\n\n```csharp\nservices.AddAuth0WebAppAuthentication(options =\u003e\n{\n    options.Domain = Configuration[\"Auth0:Domain\"];\n    options.ClientId = Configuration[\"Auth0:ClientId\"];\n});\n```\n\n### Login and Logout\nTriggering login or logout is done using ASP.NET's `HttpContext`:\n\n```csharp\npublic async Task Login(string returnUrl = \"/\")\n{\n    var authenticationProperties = new LoginAuthenticationPropertiesBuilder()\n        .WithRedirectUri(returnUrl)\n        .Build();\n\n    await HttpContext.ChallengeAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);\n}\n\n[Authorize]\npublic async Task Logout()\n{\n    var authenticationProperties = new LogoutAuthenticationPropertiesBuilder()\n        // Indicate here where Auth0 should redirect the user after a logout.\n        // Note that the resulting absolute Uri must be added in the\n        // **Allowed Logout URLs** settings for the client.\n        .WithRedirectUri(Url.Action(\"Index\", \"Home\"))\n        .Build();\n\n    await HttpContext.SignOutAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);\n    await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);\n}\n```\n\nFor more code samples on how to integrate the **auth0-aspnetcore-authentication** SDK in your **ASP.NET MVC** application, have a look at our [examples](https://github.com/auth0/auth0-aspnetcore-authentication/blob/main/EXAMPLES.md).\n\n\u003e This SDK also works with Blazor Server, for more info see [the Blazor Server section in our examples](https://github.com/auth0/auth0-aspnetcore-authentication/blob/main/EXAMPLES.md#blazor-server).\n\n## Multiple Custom Domain (MCD) Support\n\nMultiple 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.\n\nResolver 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.\n\n### Configuration\n\n```csharp\nservices.AddAuth0WebAppAuthentication(options =\u003e\n{\n    options.Domain = Configuration[\"Auth0:Domain\"];\n    options.ClientId = Configuration[\"Auth0:ClientId\"];\n})\n.WithCustomDomains(options =\u003e\n{\n    // Example: resolve from a custom header\n    options.DomainResolver = httpContext =\u003e\n    {\n        var tenant = httpContext.Request.Headers[\"X-Tenant-Domain\"].FirstOrDefault();\n        return Task.FromResult(tenant ?? \"default-tenant.auth0.com\");\n    };\n});\n```\n\nFor detailed configuration options, caching strategies, security requirements, and more examples, see the [Multiple Custom Domain (MCD) Examples](EXAMPLES.md#multiple-custom-domain-mcd-support).\n\n## API reference\nExplore public API's available in auth0-aspnetcore-authentication.\n\n- [Auth0WebAppOptions](https://auth0.github.io/auth0-aspnetcore-authentication/api/Auth0.AspNetCore.Authentication.Auth0WebAppOptions.html)\n- [Auth0WebAppWithAccessTokenOptions](https://auth0.github.io/auth0-aspnetcore-authentication/api/Auth0.AspNetCore.Authentication.Auth0WebAppWithAccessTokenOptions.html)\n- [LoginAuthenticationPropertiesBuilder](https://auth0.github.io/auth0-aspnetcore-authentication/api/Auth0.AspNetCore.Authentication.LoginAuthenticationPropertiesBuilder.html)\n- [LogoutAuthenticationPropertiesBuilder](https://auth0.github.io/auth0-aspnetcore-authentication/api/Auth0.AspNetCore.Authentication.LogoutAuthenticationPropertiesBuilder.html)\n- [Auth0WebAppAuthenticationBuilder](https://auth0.github.io/auth0-aspnetcore-authentication/api/Auth0.AspNetCore.Authentication.Auth0WebAppAuthenticationBuilder.html)\n- [Auth0WebAppWithAccessTokenAuthenticationBuilder](https://auth0.github.io/auth0-aspnetcore-authentication/api/Auth0.AspNetCore.Authentication.Auth0WebAppWithAccessTokenAuthenticationBuilder.html)\n\n## Feedback\n### Contributing\n\nWe appreciate feedback and contribution to this repo! Before you get started, please see the following:\n\n- [Auth0's general contribution guidelines](https://github.com/auth0/open-source-template/blob/master/GENERAL-CONTRIBUTING.md)\n- [Auth0's code of conduct guidelines](https://github.com/auth0/open-source-template/blob/master/CODE-OF-CONDUCT.md)\n- [This repo's contribution guide](https://github.com/auth0/auth0-aspnetcore-authentication/blob/main/CONTRIBUTING.md)\n\n### Raise an issue\n\nTo provide feedback or report a bug, please [raise an issue on our issue tracker](https://github.com/auth0/auth0-aspnetcore-authentication/issues).\n\n### Vulnerability Reporting\n\nPlease do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/responsible-disclosure-policy) details the procedure for disclosing security issues.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\"   width=\"150\"\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.auth0.com/website/sdks/logos/auth0_dark_mode.png\" width=\"150\"\u003e\n    \u003cimg alt=\"Auth0 Logo\" src=\"https://cdn.auth0.com/website/sdks/logos/auth0_light_mode.png\" width=\"150\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003eAuth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout \u003ca href=\"https://auth0.com/why-auth0\"\u003eWhy Auth0?\u003c/a\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\nThis project is licensed under the MIT license. See the \u003ca href=\"https://github.com/auth0/auth0-aspnetcore-authentication/blob/main/LICENSE\"\u003eLICENSE\u003c/a\u003e file for more info.\u003c/p\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fauth0-aspnetcore-authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0%2Fauth0-aspnetcore-authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fauth0-aspnetcore-authentication/lists"}