Skip to content
Livestream: Why now's a good time to upgrade to Duende IdentityServer and .NET 10. Register Now!

Hosting

You add the Duende IdentityServer engine to any ASP.NET Core application by adding the relevant services to the dependency injection (DI) system and adding the middleware to the processing pipeline.

You add the necessary services to the ASP.NET Core service provider by calling AddIdentityServer at application startup:

Program.cs
var idsvrBuilder = builder.Services.AddIdentityServer(options =>
{
// ...
});

Many of the fundamental configuration settings can be set on the options. See the IdentityServerOptions reference for more details.

The builder object has a number of extension methods to add additional services to the ASP.NET Core service provider. You can see the full list in the reference section, but very commonly you start by adding the configuration stores for clients and resources, e.g.:

Program.cs
var idsvrBuilder = builder.Services.AddIdentityServer()
.AddInMemoryClients(Config.Clients)
.AddInMemoryIdentityResources(Config.IdentityResources)
.AddInMemoryApiScopes(Config.ApiScopes)

The above is using the in-memory stores, but we also support EntityFramework-based implementations and custom stores. See here for more information.