Search⌘ K
AI Features

Configuring SSO in Blazor Server

Explore how to configure OpenID Connect authentication in a Blazor Server application. This lesson guides you through adding required dependencies, setting up OIDC in the Program.cs file, and enabling login/logout links in Razor components. Understand the process of securing Blazor Server apps similarly to Razor Pages while applying authorization in individual components.

In this lesson, we will learn how to apply the OIDC authentication configuration in a Blazor Server application. We will do so by using the playground below:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
Blazor Server app with the OpenID Connect flow

Note: Because we have to build two ASP.NET Core applications and populate the IdP database with the initial seed data, the build process is expected to take at least a few minutes.

In this playground, we have the following two application projects:

  • DemoApp: This is our Blazor Server application.

  • OpenIddictAuthProvider: This is the IdP ...