Nedo.AspNet.Authentication.Auth0 2.0.9

dotnet add package Nedo.AspNet.Authentication.Auth0 --version 2.0.9
                    
NuGet\Install-Package Nedo.AspNet.Authentication.Auth0 -Version 2.0.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nedo.AspNet.Authentication.Auth0" Version="2.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nedo.AspNet.Authentication.Auth0" Version="2.0.9" />
                    
Directory.Packages.props
<PackageReference Include="Nedo.AspNet.Authentication.Auth0" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nedo.AspNet.Authentication.Auth0 --version 2.0.9
                    
#r "nuget: Nedo.AspNet.Authentication.Auth0, 2.0.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nedo.AspNet.Authentication.Auth0@2.0.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nedo.AspNet.Authentication.Auth0&version=2.0.9
                    
Install as a Cake Addin
#tool nuget:?package=Nedo.AspNet.Authentication.Auth0&version=2.0.9
                    
Install as a Cake Tool

Nedo.AspNet.Authentication.Auth0

Auth0 as the canonical token issuer (JWT-bearer pattern). Validates Auth0-issued JWTs and auto-maps Auth0's namespace-prefixed custom claims + RBAC permissions to ASP.NET Core's ClaimTypes.Role.

Install

dotnet add package Nedo.AspNet.Authentication.Auth0

Quickstart

using Nedo.AspNet.Authentication.Auth0;

builder.Services.AddAuth0(opts =>
{
    opts.Domain   = builder.Configuration["Auth0:Domain"]!;     // "my-tenant.auth0.com"
    opts.Audience = builder.Configuration["Auth0:Audience"]!;   // "https://api.example.com"
});

builder.Services.AddAuthorization();
builder.Services.AddHttpContextAccessor();
builder.Services.AddScoped<IAuthContext, AuthContext>();

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

app.MapGet("/admin", (IAuthContext auth) => auth.UserId)
   .RequireAuthorization(p => p.RequireRole("admin"));

Claims auto-mapping

Auth0 prefixes custom claims with a namespace URL (e.g. https://my-app.example.com/roles) to comply with OIDC. The defaults map the common shapes:

Auth0 claim Mapped to
https://{namespace}/roles: ["admin"] ClaimTypes.Role
permissions: ["read:reports", "write:reports"] (Auth0 RBAC) permission claims
email_verified left as-is
sub ClaimTypes.NameIdentifier

Configure your namespace via opts.RolesClaimNamespace = "https://my-app.example.com/roles"; if you use a non-default URL pattern.

Auth0 Action / Rule prerequisites

To get roles and permissions in the access token, configure them on the Auth0 side:

  • Roles — add an Action that copies event.user.app_metadata.roles (or your role source) onto event.accessToken under your namespace claim:
    exports.onExecutePostLogin = async (event, api) => {
        const namespace = 'https://my-app.example.com/';
        api.accessToken.setCustomClaim(`${namespace}roles`, event.user.app_metadata?.roles ?? []);
    };
    
  • Permissions — enable RBAC + "Add Permissions in the Access Token" on the API in the Auth0 dashboard.

Docs

docs/04-identity-providers.md.

License

MIT — see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.9 88 5/11/2026
2.0.8 89 5/6/2026
2.0.7 79 5/5/2026
2.0.6 85 5/5/2026
2.0.4 97 5/4/2026
2.0.3 87 5/4/2026
2.0.2 94 5/2/2026
2.0.1 92 5/2/2026
2.0.0 91 5/1/2026