Search code examples
c#asp.net-core.net-coreasp.net-identity

How to use AddIdentityApiEndpoints inside a class library?


I have separated my identity code into a dedicated class library. I have an IServiceCollection extension method for adding everything I need except this one line:

builder.Services.AddIdentityApiEndpoints<IdentityUser>()
    .AddEntityFrameworkStores<ApplicationDbContext>();

No matter which package I include, AddIdentityApiEndpoints is never recognized. What do I need to do to be able to use AddIdentityApiEndpoints from within a class library?


Solution

  • The documentation page's "Definition" section is terse, but it essentially says that you need to have: