dotnet-blazor-auth

Implement authentication and authorization flows for Blazor applications across hosting models.

1|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-blazor-auth-rudironsoni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-blazor-auth
Source: https://github.com/rudironsoni/dotnet-agent-harness/tree/main/.rulesync/skills/dotnet-blazor-auth
Command: npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-blazor-auth-rudironsoni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complexities of implementing secure authentication and authorization flows within Blazor applications across various hosting models.

Core Features & Use Cases

  • Hosting Model Auth: Implements auth patterns for Server, WASM, Auto, SSR, and Hybrid Blazor apps.
  • UI Components: Utilizes AuthorizeView and CascadingAuthenticationState for conditional rendering and state management.
  • Identity Management: Guides through scaffolding and customizing ASP.NET Core Identity for user management.
  • External Providers: Facilitates integration with OAuth/OIDC providers like Microsoft and Google.
  • Use Case: Securely implement user login, role-based access control, and external provider authentication in a new Blazor Web App.

Quick Start

Implement Blazor authentication and authorization flows for a Blazor Web App.

Frequently Asked Questions about dotnet-blazor-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement authentication and authorization in Blazor WebAssembly?

Blazor WebAssembly authentication uses `CascadingAuthenticationState` and `AuthorizeView` components to manage user state and conditionally render UI. You configure OIDC providers for secure client-side access and handle token refreshes to maintain user sessions.

What is the best way to secure a Blazor Server app using ASP.NET Core Identity?

Securing a Blazor Server app involves scaffolding ASP.NET Core Identity for user management and applying role or policy-based authorization. This approach keeps authentication state server-side and integrates with Blazor's authorization components.

Does Blazor authentication work across Static SSR and Auto hosting models?

Yes, Blazor authentication works across Static SSR and Auto hosting models. You implement secure auth flows by adapting ASP.NET Core Identity and external OIDC provider integrations to the specific lifecycle and rendering constraints of each hosting model.

How do I integrate external OAuth providers like Google with Blazor authorization?

Integrating external OAuth providers like Google with Blazor authorization requires configuring OIDC authentication middleware in ASP.NET Core. This enables external login flows, allowing the `AuthorizeView` component to render role-specific UI based on external identity claims.

How do I handle token refresh mechanisms in Blazor WebAssembly?

Handling token refresh in Blazor WebAssembly requires implementing a secure mechanism via platform-specific auth APIs. You intercept HTTP requests to attach valid access tokens and silently refresh them using refresh tokens before they expire.

When should I use policy-based authorization instead of role-based authorization in Blazor?

Use policy-based authorization in Blazor when you need complex, rule-based access control beyond simple role checks. Policies evaluate multiple claims or custom logic requirements, providing granular UI protection via `AuthorizeView` and `CascadingAuthenticationState`.