AuthEndpoints is an authentication library for ASP.NET Core Identity that gives you ready-made login, register, refresh, 2FA, passkey and password reset endpoints. It is for your own web and mobile clients. You keep ASP.NET Core Identity, your user type, and your database.
- Cookie sessions for browser apps, and JWT bearer sessions for token clients, including refresh
- Two-factor authentication with authenticator codes and recovery codes
- Passkeys (WebAuthn) for passwordless register and login
- Email-code sign-in. Account creation and magic links stay off until you enable them
- Password facade with
AddPasswordAuth,UseAuthEndpoints, andMapPasswordAuth. Cookie is the default session. SetAuthEndpointsSession.Jwtfor a JWT bearer session - Account lifecycle: register, confirm email, forgot and reset password, manage account info, and step-up ReAuth
- Hardening on the routes: rate limits, antiforgery, lockout-aware login, and hashed JWT refresh tokens with reuse detection
- GitHub and Google sign-in through
AuthEndpoints.OAuth.GitHubandAuthEndpoints.OAuth.Google. The endpoints live in the core package. Compose them. The password facade does not map them. See External OAuth
MapIdentityApi maps one fixed set of Identity API endpoints. AuthEndpoints covers register, login, refresh, and password reset, and adds cookie sessions, JWT bearer sessions, passkeys, logout, and a choice of which routes to map.
The route-by-route comparison is in AuthEndpoints compared with MapIdentityApi.
Requires .NET 10, ASP.NET Core Identity, and EF Core.
dotnet add package AuthEndpointsbuilder.Services.AddDbContext<AppDbContext>(/* your provider */);
builder.Services.AddPasswordAuth<AppUser, AppDbContext>(o =>
{
o.Passkeys.ServerDomain = "example.com"; // omit to leave passkeys off
});
builder.Services.AddTransient<IEmailSender<AppUser>, MyEmailSender>();
var app = builder.Build();
app.UseAuthEndpoints();
app.MapPasswordAuth<AppUser>();
app.Run();Guides, route tables, and production setup are at https://authendpoints.harten.id.
Add the coding-agent skill from this repository:
npx skills add madeyoga/AuthEndpointsSee AI agents.
Issues and pull requests are welcome. Open an issue at madeyoga/AuthEndpoints to report bugs or propose changes.
This project is licensed under the MIT License.
