Skip to content

About

A composable authentication endpoints library for aspnetcore.

Topics

Resources

Security policy

Stars

122 stars

Watchers

1 watching

Forks

Repository files navigation

AuthEndpoints: authentication library for ASP.NET Core Identity

AuthEndpoints

Version Downloads License Docs

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, and MapPasswordAuth. Cookie is the default session. Set AuthEndpointsSession.Jwt for 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.GitHub and AuthEndpoints.OAuth.Google. The endpoints live in the core package. Compose them. The password facade does not map them. See External OAuth

Why not MapIdentityApi?

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.

Getting started

Requires .NET 10, ASP.NET Core Identity, and EF Core.

dotnet add package AuthEndpoints
builder.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();

Documentation

Guides, route tables, and production setup are at https://authendpoints.harten.id.

AI agents

Add the coding-agent skill from this repository:

npx skills add madeyoga/AuthEndpoints

See AI agents.

Contribute

Issues and pull requests are welcome. Open an issue at madeyoga/AuthEndpoints to report bugs or propose changes.

License

This project is licensed under the MIT License.

About

A composable authentication endpoints library for aspnetcore.

Topics

Resources

Security policy

Stars

122 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages