...

/

Configuring SSO in Blazor WebAssembly

Configuring SSO in Blazor WebAssembly

Learn how to apply SSO in a Razor WebAssembly application.

In this lesson, we will learn how to enable SSO in a Blazor WebAssembly application. To demonstrate how it's done, we have the following playground:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
Blazor WebAssembly 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.

This playground consists of the following two application projects:

  • DemoApp: This is the Blazor WebAssembly application.

  • OpenIddictAuthProvider: This is the IdP server application.

If we launch the application and wait for it to build, we will see the following home page:

Press + to interact
Home page of a Blazor application
Home page of a Blazor application

When we click the "Log in" link in the top-right corner, we will be redirected to the IdP authentication page, where we can register a new user and log in. Because this environment is self-contained, any users registered in the previous lessons will no longer exist in the database. Therefore, we will have to register a new user upon launching the new playground session.

OIDC dependencies in Blazor WebAssembly

Authentication ...