Skip to content

IdentityPasskeyData.Name not persisted when using custom Guid keys #63923

@spin973

Description

@spin973

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

  1. Create an IdentityDbContext with Guid 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
}
  1. Register a passkey with a name using the standard Identity UI
  2. 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions