
For enterprise and SaaS apps, integrating OpenID Connect (OIDC) with Blazor WASM gives you standards-based authentication with providers like Microsoft Entra ID, Google, Okta, and Auth0.
// Program.cs:
builder.Services.AddOidcAuthentication(options =>
{
builder.Configuration.Bind("Auth0", options.ProviderOptions);
options.ProviderOptions.ResponseType = "code";
});{
"Auth0": {
"Authority": "https://your-tenant.auth0.com",
"ClientId": "your-client-id"
}
}<AuthorizeView>
<Authorized>
<button @onclick="LogOut">Log Out</button>
</Authorized>
<NotAuthorized>
<button @onclick="LogIn">Log In</button>
</NotAuthorized>
</AuthorizeView>
@code {
private void LogIn() =>
Nav.NavigateTo("authentication/login");
private async Task LogOut() =>
Nav.NavigateTo("authentication/logout");
}Reference:
TaskLoco™ — The Sticky Note GOAT