Skip to content

About

Drop-in auth endpoints for ASP.NET Core: JWT, cookies, email codes and 2FA for your SPA or API, built on ASP.NET Core Identity.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

124 stars

Watchers

1 watching

Forks

Repository files navigation

AuthEndpoints: authentication library for ASP.NET Core Identity

AuthEndpoints

Build 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. Built for first-party SPAs, mobile apps, and APIs.

  • Cookie sessions for browser apps, and JWT bearer sessions with refresh for token clients
  • Two-factor authentication, passkeys (WebAuthn), and email-code sign-in
  • Account lifecycle: register, confirm email, reset password, manage account, and step-up ReAuth
  • Hardening: rate limits, antiforgery, lockout-aware login, and refresh-token reuse detection
  • GitHub and Google sign-in. 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();

This maps register, login, logout, email confirmation, password reset, ReAuth, and account management (/auth/manage/info, /auth/manage/2fa, /auth/manage/password) under /auth, plus passkeys under /auth/passkeys when ServerDomain is set; see the endpoint reference for every route.

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. Read CONTRIBUTING.md first, and look for issues labeled good first issue to get started.

License

This project is licensed under the MIT License.

About

Drop-in auth endpoints for ASP.NET Core: JWT, cookies, email codes and 2FA for your SPA or API, built on ASP.NET Core Identity.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

124 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages