-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Describe the bug
When using ASP.NET Core Identity with custom Guid
keys instead of the default string
keys, the Name
property of IdentityPasskeyData
is not persisted when saving a passkey using UserManager.SetPasskeyAsync()
.
All other properties in IdentityPasskeyData
are correctly serialized and saved (PublicKey, CreatedAt, IsBackedUp, etc.), but Name
always remains null
in the database.
To Reproduce
- Create an
IdentityDbContext
withGuid
as the key type:
public class IdentityUserPasskeyEntity : IdentityUserPasskey<Guid> { }
public sealed class ApplicationDbContext :
IdentityDbContext
IdentityUser<Guid>,
IdentityRole<Guid>,
Guid,
IdentityUserClaim<Guid>,
IdentityUserRole<Guid>,
IdentityUserLogin<Guid>,
IdentityRoleClaim<Guid>,
IdentityUserToken<Guid>,
IdentityUserPasskeyEntity>
{
// Standard configuration
}
- Register a passkey with a name using the standard Identity UI
- Check the UserPasskey table - the Data column JSON shows "Name": null
Expected behavior
The Name property should be serialized and persisted correctly, regardless of the key type.
Actual behavior
Database JSON:
{
"Name": null, // ❌ Should contain the passkey name
"PublicKey": "...",
"CreatedAt": "2025-10-04T13:59:35.5226805+00:00",
"IsBackedUp": false,
...
}
Environment
.NET version: 10.0 (10.0.0-rc.1.25451.107)
Database: SQL Server
Identity configuration: Custom Guid keys with IdentityUserPasskey
Additional context
The same code works correctly with the default scaffolded Identity (using string keys)
This appears to be a regression or oversight when handling non-string key types
All other IdentityPasskeyData properties serialize correctly.
Repo to reproduce the issue: https://github.com/spin973/BlazorAppNet10