3.x facade, kept for compatibility
AddAuthEndpoints and MapAuthEndpoints are the 3.x facade. They are not obsolete. Names, options, AuthEndpointsSignIn, EmailCode.Enabled, and the /identity, /account, and /auth routes stay at 3.4.1. New hosts that want one password session use Password auth. Do not call both facades in one host.
builder.Services.AddAuthEndpoints<AppUser, AppDbContext>(options =>
{
options.Passkeys.ServerDomain = "example.com";
});
app.UseAuthEndpoints();
app.MapAuthEndpoints<AppUser>();
Identity bearer is AddAuthEndpoints<AppUser, AppDbContext>(AuthEndpointsSignIn.IdentityBearer, ...). JWT on this facade is options.Jwt.Enabled = true plus Jwt.Configure. Passkeys are on until Passkeys.Enabled is false. Email-code sign-in is off until EmailCode.Enabled is true.
AddPasswordAuth<TUser, TRole, TContext> registers Identity roles before the EF stores. The three-type AddAuthEndpoints<TUser, TRole, TContext> overload is unchanged. Your DbContext must be IdentityDbContext<TUser, TRole, TKey> or equivalent. Do not chain .AddRoles<TRole>() after the two-type overload.
The changes that do apply to this facade are in Upgrade to 4.0. Password login, JWT POST /create failure text, and email-code verify stay on the 3.4.1 handlers, apart from those exceptions. POST and DELETE /manage/password stay unmapped here. The password facade maps both.
MapBearerAuthEndpoints maps no CSRF token route. On this facade, Identity bearer omits antiforgery on POST /account/passkeys/requestOptions, POST /account/passkeys/register/options, POST /account/passkeys/register, and POST /account/passkeys/login. The cookie facade still requires it on those routes, and GET /identity/csrfToken issues the token. Signed-in passkey changes require the token on both facades. The Identity ceremony state lives in the TwoFactorUserIdScheme cookie (Identity.TwoFactorUserId). That cookie is single-use state, not a credential, and clients must send it between the options call and the verify call. If you do not use passkeys, set Passkeys.Enabled to false. The session rule is in Antiforgery (CSRF) rules.
Options
AddAuthEndpoints<TUser, TContext>(…) and AddAuthEndpoints<TUser, TRole, TContext>(…) take AuthEndpointsOptions.
| Property | Default | Description |
|---|---|---|
IdentityPath | /identity | Route prefix for Identity management plus the configured sign-in stack |
SignIn | Cookie | AuthEndpointsSignIn.Cookie or IdentityBearer. Pass IdentityBearer as the first argument to AddAuthEndpoints, or set o.SignIn. |
PasskeyPath | /account | Route prefix for passkey endpoints |
RequireConfirmedAccount | true | Identity requires a confirmed account before sign-in |
Passkeys | (enabled) | AuthEndpointsPasskeyOptions |
EmailConfirmation | (unset) | ConfirmEmailRedirectUri and AllowedRedirectOrigins. The rules are in Configuration options. |
Jwt | (disabled) | AuthEndpointsJwtOptions |
EmailCode | (disabled) | AuthEndpointsEmailCodeOptions |
ReAuth | 5 minutes | AuthEndpointsReAuthOptions.Lifetime for the ReAuth cookie and reauthToken |
ConfigureIdentity | null | Optional Action<IdentityOptions> applied after secure defaults |
ConfigurePasskeys | null | Optional Action<IdentityPasskeyOptions> after ServerDomain is applied |
RequireEmailSenderInProduction | true | Production must register a real IEmailSender<TUser> (not Identity's no-op) |
AuthEndpointsPasskeyOptions:
| Property | Default | Description |
|---|---|---|
Enabled | true | When false, passkey DI and mapping are skipped |
ServerDomain | null | WebAuthn relying-party domain (e.g. example.com). Required in Production when enabled |
AuthEndpointsJwtOptions:
| Property | Default | Description |
|---|---|---|
Enabled | false | When true, registers and maps JWT endpoints |
Path | /auth | Route prefix for JWT endpoints |
Configure | null | Optional Action<SimpleJwtOptions> for issuer, audience, signing, lifetimes |
AuthEndpointsEmailCodeOptions (o.EmailCode):
| Property | Default | Description |
|---|---|---|
Enabled | false | When true, registers and maps POST /emailCode/send and POST /emailCode/verify under IdentityPath |
Configure | null | Optional Action<EmailCodeOptions>. Set AllowSignUp here. |
When Jwt.Enabled or EmailCode.Enabled is true, call modelBuilder.UseRefreshToken() or modelBuilder.UseEmailCodes() on your DbContext and migrate.
o.ReAuth.Lifetime is applied after every Configure<AuthEndpointsReAuthOptions>, so set the lifetime here on this facade.
builder.Services.AddAuthEndpoints<AppUser, AppDbContext>(o =>
{
o.IdentityPath = "/auth/cookie";
o.PasskeyPath = "/auth/passkey";
o.RequireConfirmedAccount = true;
o.Passkeys.ServerDomain = "example.com";
o.ConfigureIdentity = identity =>
{
identity.Password.RequiredLength = 10;
};
o.ReAuth.Lifetime = TimeSpan.FromMinutes(2);
o.Jwt.Enabled = true;
o.Jwt.Path = "/auth/jwt";
o.Jwt.Configure = jwt =>
{
jwt.Issuer = "https://example.com";
jwt.Audience = "https://example.com";
jwt.SigningOptions.SymmetricKey = builder.Configuration["Jwt:SymmetricKey"];
};
});
AuthEndpointsOptionsValidator fails when the host also calls AddPasswordAuth. It checks the IdentityPath, PasskeyPath, and Jwt.Path formats, and the Production passkey domain. It checks EmailConfirmation with the same rules as AddPasswordAuth: an illegal redirect URI fails in every environment, and the https, allowlist, and origin checks run in Production. AuthEndpointsEmailSenderValidator checks the email sender in Production.
What it registers
AddAuthEndpoints calls AddAuthEndpointsIdentity and AddCookieAuthEndpoints. It also calls AddBearerAuthEndpoints when SignIn is IdentityBearer, AddPasskeyEndpoints unless Passkeys.Enabled is false, AddJwtEndpoints when Jwt.Enabled is true, and AddEmailCodeEndpoints when EmailCode.Enabled is true. Those calls register the ReAuth schemes and the rate-limit policies. AddAuthEndpointsIdentity sets Stores.SchemaVersion to version 3, which external unlink needs to count passkeys.
What it maps
| Group | Prefix | Mapped when |
|---|---|---|
Identity management: register, confirm and resend, forgot and reset, /manage/info, /manage/2fa, /manage/authMethods, /confirmIdentity, /confirmIdentity/passkeyOptions | IdentityPath (/identity) | Always |
Cookie POST /login, POST /logout, GET /csrfToken | IdentityPath | SignIn is Cookie |
Identity bearer POST /login, POST /refresh, POST /logout | IdentityPath | SignIn is IdentityBearer |
POST /emailCode/send, POST /emailCode/verify | IdentityPath | EmailCode.Enabled is true |
Passkey sign-in and management (MapPasskeyEndpoints) | PasskeyPath (/account), under /passkeys | Passkeys.Enabled is true |
JWT POST /create, POST /refresh, GET /verify, POST /logout, GET /csrfToken | Jwt.Path (/auth) | Jwt.Enabled is true |
It does not map POST /manage/password, DELETE /manage/password, or POST /confirmIdentity/emailCode/send. authMethods.emailCode stays false. It does not map external OAuth routes. Map them yourself, as on External OAuth.
The CSRF token routes are GET /identity/csrfToken for the cookie sign-in and GET /auth/csrfToken for JWT. The JWT route exists only with cookie refresh transport. With body transport, GET /auth/csrfToken returns 404.
How sign-in behaves
This facade ignores SignInCompletionOptions.Default. That covers password login, JWT POST /create, and email-code verify.
- Cookie
POST /identity/loginuses theLoginCookiehandler.?useCookies=truehas no effect there. A persistent cookie is?useSessionCookies=false. - Login does not run the unknown-email hash verify, so an unknown email can return faster than a wrong password.
- JWT
POST /createkeeps the 3.4.1 handler. A wrong authenticator code returns401with detailInvalid two factor code.and does not count toward lockout. A wrong recovery code returns401with the Identity error description (default English: "Recovery code redemption failed.").POST /createcallsDefaultAuthenticator, so it does run the unknown-email hash verify. - Email-code verify uses an explicitly registered
IEmailCodeSignInCompleter<TUser>, otherwise Identity bearer.Jwt.Enableddoes not change it. - Passkey register and login use an explicitly registered
IPasskeySignInCompleter<TUser>, otherwise Identity bearer. That completer follows the Identity bearer query flags (useCookiesoruseSessionCookies), notLoginCookie.