Upgrade to 4.0Changelog

AuthEndpoints: authentication library for ASP.NET Core Identity

Ready-made sign-up and sign-in endpoints for ASP.NET Core Identity: passwords, passkeys, email codes, OAuth, and 2FA.

Free and MIT licensed · No account or hosted service · Runs on your own database

Confused by ASP.NET Core auth?

Writing code is cheap now. Bugs aren't. Shared code is still the fastest way to get fewer of them, and AuthEndpoints is that shared code for auth.

dotnet add package AuthEndpoints

Program.cs

  1. builder.Services.AddDbContext<AppDbContext>(/* your provider */);
  2. builder.Services.AddPasswordAuth<AppUser, AppDbContext>(o =>
  3. {
  4. o.Passkeys.ServerDomain = "example.com";
  5. });
  6. var app = builder.Build();
  7. app.UseAuthEndpoints();
  8. app.MapPasswordAuth<AppUser>();

Mapped for you

  • POST/auth/register
  • POST/auth/login
  • POST/auth/logout
  • GET/auth/confirmEmail
  • POST/auth/forgotPassword
  • POST/auth/resetPassword
  • POST/auth/manage/2fa
  • + more password auth routes

Cookie session by default · JWT via AuthEndpointsSession.Jwt

What AuthEndpoints can do

Each capability links to the guide that shows you how to use it.

    Register with an email and password

    Create accounts and send confirmation email.

    Register with a passkey

    Create passwordless accounts with WebAuthn.

    GitHub and Google sign-in

    Add GitHub or Google sign-in. The endpoints are in the core package.

    Cookie sessions

    Sign browser users in with a secure app cookie.

    Identity bearer tokens

    Issue access and refresh tokens for mobile apps.

    JWT with a refresh cookie

    Issue short-lived JWTs with rotating refresh tokens.

    Passkey sign-in

    Sign users in with a passkey.

    Emailed one-time code

    Sign in with a code. Sign-up and magic links stay off until you enable them.

    Two-factor authentication

    Turn on authenticator codes and recovery codes.

    Password reset

    Send reset codes and set a new password.

    Email change

    Change the email after the user confirms it.

    Passkey management

    Add, rename, and remove passkeys.

    Account linking

    Link and unlink GitHub or Google accounts.

    Step-up (ReAuth)

    Ask for proof again before sensitive changes.

    Built-in protection

    CSRF, rate limits, lockout, and checks at startup.

    Composable modules

    Map only the routes you need, on your own prefixes.

    MapIdentityApi alternative

    Logout, chosen routes, JWT, and passkeys.

Start with password sign-in

The quick start uses AddPasswordAuth and MapPasswordAuth. Pick another setup when you need JWT, passkeys, an emailed code, or an external provider.