An example Blazor application that accesses an API service, both secured with ASP.NET Identity.
The system has two primary components:
- A Blazor web application application that serves as the front-end
- An ASP.NET Core web api that serves as the backend.
Both are secured with cookies created by the ASP.NET Identity framework. Users are stored in SQL Server using Entity Framework.
Both applications are secured using cookies generated by the ASP.NET Identity framework.
Configuring cookie creation with a shared Data Protection key was the key to getting this to work harmoniously. The common data protection key is set up using this configuration:
services.AddDataProtection()
.SetApplicationName("BlazorIdentity");
For more information on configuring ASP.NET Core data protection, see the official docs