.NET Development
Passkeys in ASP.NET Core Identity on .NET 10: tested end to end, and three traps
On .NET 10, ASP.NET Core Identity registers and verifies passkeys with no external library. We tested it with a small Minimal APIs app and headless Microsoft Edge driving a virtual authenticator: passwordless sign-up, sign-in with a username and sign-in without one all returned 200. The surprises came from the hostile cases: without ServerDomain, the Host header decides the RP ID; asking for options with a username reveals which accounts have a passkey; and a POST without the previous step's state returns 500, not 401.
What a passkey is, and why phishing can't reuse it
The FIDO Alliance defines it this way: "A passkey is an authentication credential based on FIDO standards". Phishing resistance comes from binding each passkey to a Relying Party ID, the RP ID. According to WebAuthn Level 3, the RP ID "must be equal to the origin’s effective domain", or be a registrable suffix of that domain. A fake site on another domain can't ask for a signature for the real site's RP ID, because the browser rejects an RP ID that breaks that rule.
The Identity documentation presents it as "a modern, phishing-resistant authentication method based on the Web Authentication API (WebAuthn) and FIDO2 standards", and sets the scope: "It isn't intended as a general-purpose WebAuthn library."
What we tested, and with what
.NET SDK 10.0.401, Microsoft.AspNetCore.Identity.EntityFrameworkCore 10.0.14 and in-memory SQLite. The browser is headless Edge 157, driven over the DevTools protocol (CDP) by a Node script with no dependencies. There's no person and no device: an Edge virtual authenticator answers every WebAuthn prompt, with these options:
const { authenticatorId } = await cdp.send('WebAuthn.addVirtualAuthenticator', {
options: { protocol: 'ctap2', transport: 'internal', hasResidentKey: true, hasUserVerification: true, isUserVerified: true, automaticPresenceSimulation: true },
});
That covers a platform authenticator with discoverable credentials and user verification. We didn't test Windows Hello, an iPhone, passkeys synced through iCloud or Google, or a physical key. Anything we say about those cases is marked as unverified.
We ran two copies of the app: one without ServerDomain and one with ServerDomain=localhost.
Turning it on: schema 3 and a missing service
The passkey table ships with version 3 of the Identity schema. The Blazor guide asks for it: "In Program.cs, update the Identity configuration to use schema version 3, which includes passkey support". This is the bench configuration:
builder.Services
.AddIdentity<IdentityUser, IdentityRole>(options =>
{
// Schema version 3 adds the passkey table.
options.Stores.SchemaVersion = IdentitySchemaVersions.Version3;
})
.AddEntityFrameworkStores<AppDbContext>();
builder.Services.AddAuthorization();
// PASSKEY_SERVER_DOMAIN unset: the Relying Party ID comes from the request (Host header).
var serverDomain = Environment.GetEnvironmentVariable("PASSKEY_SERVER_DOMAIN");
if (!string.IsNullOrEmpty(serverDomain))
{
builder.Services.Configure<IdentityPasskeyOptions>(options => options.ServerDomain = serverDomain);
}
The first run didn't start. UseAuthorization() without AddAuthorization() fails with "Unable to find the required services. Please add all the required services by calling 'IServiceCollection.AddAuthorization'", because AddIdentity doesn't register authorization. The line builder.Services.AddAuthorization(); fixed it.
AddAuthorization() is registered.Passwordless sign-up
It takes three calls: MakePasskeyCreationOptionsAsync builds the options for the browser, PerformPasskeyAttestationAsync verifies the new credential and AddOrUpdatePasskeyAsync stores it on the user. This is how the bench does it; the end of /signup/complete is a compensation we explain further down:
// Passwordless sign-up, step 1: create the account and return creation options.
app.MapPost("/signup/options", async (string username, UserManager<IdentityUser> users, SignInManager<IdentityUser> signIn) =>
{
var user = new IdentityUser(username);
var created = await users.CreateAsync(user);
if (!created.Succeeded)
{
return Results.BadRequest(string.Join("; ", created.Errors.Select(e => e.Code)));
}
var optionsJson = await signIn.MakePasskeyCreationOptionsAsync(new()
{
Id = await users.GetUserIdAsync(user),
Name = username,
DisplayName = username,
});
return Results.Content(optionsJson, "application/json");
});
// Sign-up, step 2: verify the new credential and store the passkey on the user named in the state.
app.MapPost("/signup/complete", async (HttpRequest request, UserManager<IdentityUser> users, SignInManager<IdentityUser> signIn, ILogger<Program> logger) =>
{
var credentialJson = await new StreamReader(request.Body).ReadToEndAsync();
var attestation = await signIn.PerformPasskeyAttestationAsync(credentialJson);
if (!attestation.Succeeded)
{
return Results.BadRequest($"attestation failed: {attestation.Failure.Message}");
}
var user = await users.FindByIdAsync(attestation.UserEntity.Id);
if (user is null)
{
return Results.BadRequest("user from the attestation state not found");
}
IdentityResult stored;
try
{
stored = await users.AddOrUpdatePasskeyAsync(user, attestation.Passkey);
}
catch (DbUpdateException ex)
{
logger.LogError(ex, "Storing the passkey failed for user {UserId}", user.Id);
stored = IdentityResult.Failed(new IdentityError { Code = "PasskeyStoreFailed", Description = "The passkey could not be stored." });
}
if (stored.Succeeded)
{
return Results.Ok("passkey stored");
}
// Compensation: step 1 created the account, so without a credential nobody can ever sign in to it.
// Remove it only if it has no other way in: no passkey, no password, no external login.
var account = await users.FindByIdAsync(attestation.UserEntity.Id);
var removed = false;
if (account is not null
&& (await users.GetPasskeysAsync(account)).Count == 0
&& !await users.HasPasswordAsync(account)
&& (await users.GetLoginsAsync(account)).Count == 0)
{
var deleted = await users.DeleteAsync(account);
removed = deleted.Succeeded;
logger.LogWarning("Sign-up compensation for user {UserId}: account removed = {Removed}", account.Id, removed);
}
return Results.Problem(
statusCode: StatusCodes.Status500InternalServerError,
title: "passkey not stored",
detail: removed ? "The account was removed; sign up again." : "The account was kept.");
});
Everything goes through SignInManager. The documentation warns what happens otherwise: an app calling IPasskeyHandler<TUser> directly "becomes responsible for storing the attestation state securely. An app that fails to do so allows an attacker to register a passkey on an account that they don't own."
This block has a flaw: it creates the account in step 1, before the passkey exists. A curl probe confirmed it: after asking for carol's options, the account exists with no passkeys and a second sign-up gets DuplicateUserName. If the user cancels the browser prompt, the username stays taken, and anyone can reserve usernames that way. The fix is to create the account in step 2, after the credential is verified, with the Id and name that SignInManager keeps in the attestation state. We tested it separately, with the same virtual authenticator:
// /signup/options: the account is not created here, only its id is chosen.
var user = new IdentityUser(username);
var optionsJson = await signIn.MakePasskeyCreationOptionsAsync(new()
{
Id = user.Id,
Name = username,
DisplayName = username,
});
// /signup/complete, after attestation.Succeeded:
var user = new IdentityUser(attestation.UserEntity.Name) { Id = attestation.UserEntity.Id };
var created = await users.CreateAsync(user);
if (!created.Succeeded)
{
return Results.BadRequest(string.Join("; ", created.Errors.Select(e => e.Code)));
}
G1 deferred sign-up alice: rp.id=localhost attestation=undefined -> 200 "passkey stored"
G2 sign-in without username: rpId=localhost allowCredentials=0 -> 200 "signed in"; /me 200 "alice"
G3 sign-in alice with username: rpId=localhost allowCredentials=1 -> 200 "signed in"; /me 200 "alice"
G4 options for carol, never completed (cancelled dialog): 200
G5 does carol exist after the cancelled sign-up: 404
G6 deferred sign-up carol afterwards: rp.id=localhost attestation=undefined -> 200 "passkey stored"
G7 sign-up alice again (duplicate name): rp.id=localhost attestation=undefined -> 400 "DuplicateUserName"
With the cancelled prompt (G4), no account is left and the username stays free (G5 and G6). The cost shows in G7: a taken or invalid username is caught in step 2, after the authenticator has already created a credential the server then rejects. After CreateAsync, step 2 goes on with AddOrUpdatePasskeyAsync, as in the bench block.
Running Identity's validators in step 1, without saving anything, stops invalid usernames before the prompt:
foreach (var validator in users.UserValidators)
{
var check = await validator.ValidateAsync(users, user);
if (!check.Succeeded)
{
return Results.BadRequest(string.Join("; ", check.Errors.Select(e => e.Code)));
}
}
V carol: 200
V carol%20: 400 "InvalidUserName"
V jos%C3%A9: 400 "InvalidUserName"
V : 400 "InvalidUserName"
Step 2 is still needed: two simultaneous sign-ups with the same username both get past step 1.
One half-finished sign-up is left: CreateAsync succeeds and AddOrUpdatePasskeyAsync fails. The account has no credential and nobody can ever sign in to it. In the bench, the account is created in /signup/options and the passkey is stored in /signup/complete: two HTTP requests, and a database transaction can't span both. So the bench block compensates: if storing fails, it deletes the account, but only if it has no other way in, no passkey, no password and no external login. We forced the failure with an EF Core interceptor that rejects the passkey row; that interceptor only exists in the bench:
F1 sign-up bob, passkey insert rejected: rp.id=localhost attestation=undefined -> 500 {"type":"https://tools.ietf.org/html/rfc9110#section-15.6.1","title":"passkey not stored","status":500,"detail":"The account was removed; sign up again."}
F2 stored passkeys of bob: 404
F3 options for bob again (name free?): 200 {"rp":{"name":"localhost","id":"loca
fail: Program[0]
Storing the passkey failed for user 902cbf99-0ff5-4abe-b09a-c31eb15bf2ee
Microsoft.EntityFrameworkCore.DbUpdateException: Injected fault: the database rejected the new passkey row.
warn: Program[0]
Sign-up compensation for user 902cbf99-0ff5-4abe-b09a-c31eb15bf2ee: account removed = True
Request finished HTTP/1.1 POST http://localhost:5199/signup/complete - 500 - application/problem+json 288.6376ms
Sign-up answers 500 with "The account was removed; sign up again.", the account no longer exists (404) and the username is free again. The compensation doesn't cover other exceptions in /signup/complete, nor the account left behind when the user walks away between the two steps; that takes a periodic cleanup of accounts without a passkey, or creating the account in step 2. In the fix above, CreateAsync and AddOrUpdatePasskeyAsync run in the same request, so the same compensation fits, but we didn't test it in that variant.
Sign-in, with a username and without one
Two more calls: MakePasskeyRequestOptionsAsync issues the challenge and PasskeySignInAsync checks the signature and sets the Identity cookie. With no username, the allowed-credentials list goes out empty and the authenticator offers whatever discoverable credentials it holds for that RP ID. The catch in /login is explained in Trap 3:
// Sign-in, step 1: request options. Without a username the allow list is empty (discoverable credentials).
app.MapPost("/login/options", async (string? username, UserManager<IdentityUser> users, SignInManager<IdentityUser> signIn) =>
{
var user = string.IsNullOrEmpty(username) ? null : await users.FindByNameAsync(username);
var optionsJson = await signIn.MakePasskeyRequestOptionsAsync(user);
return Results.Content(optionsJson, "application/json");
});
// Sign-in, step 2: verify the assertion and issue the Identity cookie.
app.MapPost("/login", async (HttpRequest request, SignInManager<IdentityUser> signIn, ILogger<Program> logger) =>
{
var credentialJson = await new StreamReader(request.Body).ReadToEndAsync();
try
{
var result = await signIn.PasskeySignInAsync(credentialJson);
return result.Succeeded ? Results.Ok("signed in") : Results.Unauthorized();
}
catch (InvalidOperationException ex) when (ex.Message.StartsWith(NoAssertionUnderway, StringComparison.Ordinal))
{
// Only the missing ceremony (no options requested, or already used) becomes a 400.
// Any other exception keeps propagating: the server logs it and answers 500.
logger.LogWarning(ex, "Passkey sign-in without a ceremony in progress");
return Results.Problem(statusCode: StatusCodes.Status400BadRequest, title: "no passkey sign-in in progress", detail: "Request new options and try again.");
}
});
In the browser, the options are converted with parseCreationOptionsFromJSON and parseRequestOptionsFromJSON, and the credential goes back to the server with JSON.stringify:
async function post(url, body) {
const r = await fetch(url, { method: 'POST', body, credentials: 'same-origin' });
return { status: r.status, text: await r.text() };
}
async function signup(username) {
const o = await post('/signup/options?username=' + encodeURIComponent(username));
if (o.status !== 200) return 'options ' + o.status + ' ' + o.text;
const options = PublicKeyCredential.parseCreationOptionsFromJSON(JSON.parse(o.text));
const credential = await navigator.credentials.create({ publicKey: options });
const done = await post('/signup/complete', JSON.stringify(credential));
return 'rp.id=' + JSON.parse(o.text).rp.id + ' attestation=' + JSON.parse(o.text).attestation + ' -> ' + done.status + ' ' + done.text;
}
async function assertion(username) {
const o = await post('/login/options' + (username ? '?username=' + encodeURIComponent(username) : ''));
const json = JSON.parse(o.text);
const options = PublicKeyCredential.parseRequestOptionsFromJSON(json);
const credential = await navigator.credentials.get({ publicKey: options });
return { rpId: json.rpId, allow: (json.allowCredentials || []).length, credentialJson: JSON.stringify(credential) };
}
What the run printed
P1 sign-up alice: rp.id=localhost attestation=undefined -> 200 "passkey stored"
P2 sign-in alice with username: rpId=localhost allowCredentials=1 -> 200 "signed in"; /me 200 "alice"
P3 sign-in without username (discoverable): rpId=localhost allowCredentials=0 -> 200 "signed in"; /me 200 "alice"
P4 stored passkeys of alice: [{"signCount":3,"isBackedUp":false,"isBackupEligible":false,"isUserVerified":true,"attestationBytes":194}]
P5 credentials in the virtual authenticator: [{"rpId":"localhost","isResidentCredential":true,"signCount":3}]
- P1. The creation options carry no
attestation, so the WebAuthn default,"none", applies, which means "The Relying Party is not interested in authenticator attestation". Identity stores the registration without validating any attestation, as its documentation says. With"none", the server gets no proof of which authenticator created the credential or who made it; that proof depends on the attestation type requested and on the server validating it. - P2 and P3. With a username, the credentials list has 1 entry; without one, 0, and the authenticator still finds the credential.
/mereturnsaliceboth times. - P4 and P5. The signature counter stored on the server (3) matches the authenticator's. Identity updates it on each sign-in to "prevent replay attacks". We didn't test what
PasskeySignInAsyncdoes with a counter that goes backwards. The specification gives it another purpose: "The signature counter’s purpose is to aid Relying Parties in detecting cloned authenticators." And it only catches anything if one of the two values is non-zero, because "Authenticators that do not implement a signature counter leave the signCount in the authenticator data constant at zero." In H2 it was stopped by the missing ceremony; in H3, Identity's code (10.0.14) checks the challenge before the counter, so it's the challenge that fails. The bench didn't log the reason for the 401. On Apple's synced passkeys, an Apple engineer answered on its developer forums in 2022: "For passkeys, signCount is not supported and will always be 0." That's a forum, not documentation. For Google we found no source, and we didn't test it outside the virtual authenticator. - Backup flags.
isBackupEligibleandisBackedUpcome outfalsebecause that's how the virtual authenticator behaves. We didn't test a synced passkey, so we don't know which values it sets.
Trap 1: the RP ID comes from the Host header
We asked both copies of the app for sign-in options with Host: evil.example:
H8 Host header evil.example, ServerDomain unset: 200 rpId=evil.example
H9 Host header evil.example, ServerDomain=localhost: 200 rpId=localhost
H11 sign-up bob, ServerDomain=localhost: rp.id=localhost attestation=undefined -> 200 "passkey stored"
H12 sign-in bob, ServerDomain=localhost: rpId=localhost allowCredentials=1 -> 200 "signed in"; /me 200 "bob"
Without ServerDomain, the server returned rpId=evil.example: whoever sends the request picks the RP ID. With ServerDomain=localhost it returned localhost, and bob's sign-up and sign-in worked the same. A script sent that Host; a browser always sends the one from the URL it opens. The real case is a foreign domain pointed at your server, or a proxy that lets any Host through.
The documentation warns about it: "The implementation infers the Relying Party ID from the host header when ServerDomain isn't explicitly configured. The hosting environment must validate host headers to prevent credential-scoping attacks". It offers two ways out, "Either explicitly configure ServerDomain in IdentityPasskeyOptions or ensure that the hosting environment (Kestrel, IIS, reverse proxy) validates host headers.", and adds: "In addition to that, if you use forwarded headers middleware, explicitly configure AllowedHosts." The Kestrel host filtering page notes that "Host headers aren't validated" and that "Host-filtering middleware is disabled by default. To enable the middleware, define an AllowedHosts key in appsettings.json". The templates already ship "AllowedHosts": "*", and per the API reference, "A top level wildcard "*" allows all non-empty hosts." List your own domains there.
When we opened the same app by its loopback IP address instead of localhost, Edge stopped before reaching the server with "This is an invalid domain": an IP address isn't a valid RP ID. That check protects the user in their browser, not a server that issues options for whatever domain it's told.
Whatever the RP ID, set with ServerDomain or taken from the Host, the passkey also works on its subdomains: "If registered on contoso.com, it also works on *.contoso.com." ServerDomain only decides which domain that is. On top of that, the default origin validation "allows requests from subdomains and disallows cross-origin iframes". So the documentation sets a condition: "Don't serve untrusted content on any subdomain within the ServerDomain scope. If you can't guarantee this, implement custom origin validation to restrict passkey usage to specific origins." That custom validation goes in ValidateOrigin on IdentityPasskeyOptions. We didn't test subdomains or iframes.
ServerDomain to the narrowest domain that serves your app, like app.contoso.com rather than contoso.com, even if the proxy filters the Host. The bench hides ServerDomain behind an environment variable only to measure both cases.Trap 2: asking for the username reveals who has a passkey
Sign-in with a username returns that account's credential list. We compared alice, who has a passkey, with a username that doesn't exist:
P2 sign-in alice with username: rpId=localhost allowCredentials=1 -> 200 "signed in"; /me 200 "alice"
H5 options for an unknown username: rpId=localhost allowCredentials=0
H1 sign-up alice again: options 400 "DuplicateUserName"
alice gets 1 credential (P2) and nobody gets 0. With that, anyone can try usernames and learn which ones have a passkey. The specification covers it in its username enumeration section: "While initiating a registration or authentication ceremony, there is a risk that the WebAuthn Relying Party might leak sensitive information about its registered users." Microsoft's page doesn't mention it.
One fix is not to ask for the username. With discoverable credentials (P3), the options go out with an empty list for everyone and the authenticator picks the account. The specification also suggests answering with "plausible imaginary values" when no account matches the username; Identity doesn't ship that. Sign-up is a different case: if users pick their own username, the response always tells whether it's taken (DuplicateUserName, in H1). There, the first step is rate-limiting /signup/options.
Trap 3: a POST without state returns 500
In the browser we tried four assertions that must not get in:
H2 replay the last assertion, no new options: 500
H3 replay the last assertion after new options: 401
H4 tampered signature: 401
H7 malformed credential JSON: 401
None got in, but the response varies. With a fresh challenge in between (H3), a tampered signature (H4) or broken JSON (H7), PasskeySignInAsync returns a failure and the endpoint answers 401: in all three, the browser already had a ceremony's state in its cookie. With no prior options (H2), the server log shows the exception the documentation describes, "Calling the method without a preceding call to MakePasskeyRequestOptionsAsync throws an InvalidOperationException":
System.InvalidOperationException: No passkey assertion is underway. Make sure to call 'SignInManager.MakePasskeyRequestOptionsAsync()' to initiate a passkey assertion.
at Microsoft.AspNetCore.Identity.SignInManager`1.PerformPasskeyAssertionAsync(String credentialJson)
at Microsoft.AspNetCore.Identity.SignInManager`1.PasskeySignInCoreAsync(String credentialJson)
at Microsoft.AspNetCore.Identity.SignInManager`1.PasskeySignInAsync(String credentialJson)
You don't need a browser to trigger it. A curl probe with no cookie got three 500s with three exceptions: junk JSON on /login throws the same InvalidOperationException, an empty body throws ArgumentException, and /signup/complete without state throws its own InvalidOperationException:
X18 POST /login without cookie, junk JSON: 500
X19 POST /login without cookie, empty body: 500
X20 POST /signup/complete without state: 500
System.InvalidOperationException: No passkey assertion is underway. Make sure to call 'SignInManager.MakePasskeyRequestOptionsAsync()' to initiate a passkey assertion.
System.ArgumentException: The value cannot be an empty string. (Parameter 'credentialJson')
System.InvalidOperationException: No passkey attestation is underway. Make sure to call 'SignInManager.MakePasskeyCreationOptionsAsync()' to initiate a passkey attestation.
The bench's /login, in the sign-in block, catches only that case. The when filter compares the start of the message with this constant, logs a warning on the server and answers 400. Any other exception keeps going: the server logs it and answers 500.
public partial class Program
{
// Start of the message SignInManager throws when PasskeySignInAsync runs without
// MakePasskeyRequestOptionsAsync (checked against .NET 10.0.14). Not a public contract: recheck on upgrades.
const string NoAssertionUnderway = "No passkey assertion is underway.";
}
With this code, the browser run only changes in H2: 500 before, 400 now. The log warning comes from another run with the same code and no injected fault, which repeats H2 with the same response:
H2 replay the last assertion, no new options: 400 {"type":"https://tools.ietf.org/html/rfc9110#section-15.5.1","title":"no passkey sign-in in progress","status":400,"detail":"Request new options and try again."
warn: Program[0]
Passkey sign-in without a ceremony in progress
System.InvalidOperationException: No passkey assertion is underway. Make sure to call 'SignInManager.MakePasskeyRequestOptionsAsync()' to initiate a passkey assertion.
Request finished HTTP/1.1 POST http://localhost:5199/login - 400 - application/problem+json 33.6052ms
To check that the filter doesn't swallow other failures, we made saving the counter throw a different InvalidOperationException after a valid sign-in. It comes out as 500 and Kestrel logs it:
F4 sign-in alice, passkey update throws: rpId=localhost allowCredentials=1 -> 500 ; /me 401
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HNPV7E1MTSB9", Request id "0HNPV7E1MTSB9:00000003": An unhandled exception was thrown by the application.
System.InvalidOperationException: Injected fault: the passkey row could not be updated.
Request finished HTTP/1.1 POST http://localhost:5199/login - 500 0 - 74.0441ms
The message text isn't a public contract: we checked it on .NET 10.0.14 and you need to recheck it when you upgrade. We found no public way to know beforehand whether a ceremony is in progress. It also misses the empty body and sign-up: answer 400 to an empty body before calling Identity, and filter the exception from PerformPasskeyAttestationAsync in /signup/complete the same way, with its own message ("No passkey attestation is underway."). We didn't test those two parts. If you'd rather have a central handler, the post on consistent error responses with Problem Details builds and tests one on ASP.NET Core 10.
One more failure never reaches the server. The documentation notes that "Some password managers don't implement the PublicKeyCredential.toJSON method correctly", with the error "Illegal invocation", and the page has the fix. It hits exactly the JSON.stringify(credential) line in the browser block.
What Identity leaves out, and when to move to FIDO2 .NET
The documentation lists its limits. Three matter for the decision:
- "No default attestation validation: The implementation doesn't validate attestation statements by default." For most consumer apps it calls that enough: "This is suitable for most consumer authentication scenarios."
- "No built-in 2FA support: Passkeys are treated as a primary authentication factor, not as a second factor." That's about Identity's flow, not about what a passkey provides. Per the specification, "All WebAuthn Authenticators belong to the something you have class, but an authenticator that supports user verification can also act as one or two additional kinds of authentication factor", so a passkey with a PIN or biometrics is already multi-factor, and the server checks it with the UV flag: "The Relying Party can therefore use the UV flag to verify that additional authentication factors were used in a registration or authentication ceremony". In the bench, the stored passkey has
isUserVerifiedset totrue(P4). Identity requires it by default. The API reference puts it this way: "The default value is "required"." Identity's 10.0.14 code ships that same value. If you change it, it stops requiring it: "If set to null, the effective value is "preferred"." We didn't test an assertion without verification, because the virtual authenticator always verifies. - "Template support: Only the Blazor Web App template includes passkey support." The bench shows it works the same with Minimal APIs, but you write the JavaScript yourself.
For attestation validation, Microsoft points to a third-party library: "Third-party libraries are available for attestation validation, such as the Passkeys - FIDO2 .NET Library (WebAuthn)". That's FIDO2 .NET, MIT-licensed, from the .NET Foundation; the latest stable release on NuGet is Fido2 4.3.2, from 2026-10-29. We didn't run it: what follows comes from its README and from Microsoft's documentation.
| Need | Identity on .NET 10 | FIDO2 .NET |
|---|---|---|
| Passkey sign-up and sign-in in an app that uses Identity | Yes, through SignInManager and UserManager | Yes, but you integrate it with the user store |
| Validate attestation (know which authenticator it is) | Not by default; there's a VerifyAttestationStatement callback you write by hand | Yes, with FIDO Metadata Service V3 |
| Block authenticator models by AAGUID | By hand, and only reliable if you validate attestation: "AAGUID reliability depends on whether your app validates attestation statements" | Allow and deny lists |
| Passkey as a second factor | No ("not as a second factor") | It's a WebAuthn server; the app designs the two-factor flow (we didn't test it) |
| Extensions (PRF, Large Blob) | The documentation doesn't mention them | Yes: PRF, Large Blob and Credential Protection |
| Ready-made template | Blazor Web App only | ASP.NET Core and Blazor WASM samples |
| Support | Microsoft | Community (.NET Foundation), no Microsoft support |
Our call: if what you need is passwordless sign-in for an app that already uses Identity, Identity is enough and saves you wiring up a user store. Move to FIDO2 .NET when you have to know or restrict which authenticator is used, for example allowing only certain key models, or when you need extensions. Keep in mind that FIDO2 .NET and other third-party libraries "aren't owned or maintained by Microsoft and aren't covered by any Microsoft Support Agreement or license".
What this bench doesn't cover
- Recovery. Lose the only passkey and the account is locked. The Blazor template "already requires users to set up a backup authentication method (password or external provider) when creating an account", and the bench's sign-up removes exactly that fallback. The documentation suggests "Recovery codes generated during account creation", "Mandatory registration of multiple passkeys" and watching the
IsBackedUpflag. - Limits. The documentation asks you to limit passkey registration, "To prevent database exhaustion attacks": "Maximum number of passkeys per user account. Maximum length for passkey display names." The Blazor template enforces them by default; we didn't look at which values it uses. The bench enforces none, and
/signup/optionsdoesn't limit attempts: anyone can create accounts. Rate-limiting public endpoints such as/signup/optionsand/login/optionsis our recommendation; the documentation doesn't ask for it. - Diagnostic endpoint.
/passkeyslists any user's passkeys without authentication. It exists only for measuring; don't copy it. - HTTPS. The bench runs over HTTP on
localhost, but the documentation requires HTTPS: "All passkey operations require HTTPS." - Storage. In-memory SQLite: everything is lost on restart.
- Malware. None of this promises protection against malware on the user's machine, and we didn't test it.
Conclusion
Before you turn on passkeys with Identity in production: set ServerDomain to the narrowest domain that serves your app, with no untrusted content on its subdomains; use username-less sign-in; create the account in step 2 and compensate if storing the passkey fails; catch only the missing-ceremony exception, let the rest become a logged 500 and answer 400 to an empty body; limit passkeys per account and the length of their names; serve everything over HTTPS; and decide how someone who loses their passkey gets their account back. If you also need to know which authenticator each account uses, start with FIDO2 .NET.
References
- Microsoft Learn: passkeys in ASP.NET Core Identity (learn.microsoft.com)
- Microsoft Learn: passkeys in Blazor Web Apps (learn.microsoft.com)
- Microsoft Learn: host filtering with Kestrel (learn.microsoft.com)
- Microsoft Learn: HostFilteringOptions.AllowedHosts (learn.microsoft.com)
- W3C: Web Authentication Level 3 (w3.org)
- FIDO Alliance: passkeys (fidoalliance.org)
- FIDO2 .NET Library: README at commit 8e45d95 (github.com)
- Apple Developer Forums: signCount on passkeys (2022) (developer.apple.com)
Tags
Share this post
Subscribe
Get the latest posts delivered right to your inbox.
Leave a comment