Official agent skill

Configure Auth

by dotnet in dotnet/skills

Add authentication and authorization to a Blazor Web App, accounting for the app's render mode.

OfficialMITAuto-check passedBusiness, Finance & HR

Install Configure Auth

skills CLI
$ npx skills add dotnet/skills --skill configure-auth -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install dotnet/skills configure-auth --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/dotnet/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/dotnet-blazor/skills/configure-auth .claude/skills/configure-auth && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
configure-auth
GitHub stars
5.6k
Used in
1 other repo
Token cost
~1.8k tokens
SKILL.md length
413 words
Files
1
Skills in repo
91
Repo updated
First seen
Licence
MIT

At a glance

Add authentication and authorization to a Blazor Web App, accounting for the app's render mode.

  • Works in 6 steps: Read AGENTS.md → Register auth services in Program.cs → Wire App.razor for auth and render mode → …
  • The user needs [Authorize] on pages
  • SKILL.md covers Step 1 — Read AGENTS.md, Step 2 — Register auth…, Step 3 — Wire App.razor for… and Step 4 — Protect pages and…, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Configure Auth is an agent skill from dotnet/skills, published by the product's own GitHub organization. Add authentication and authorization to a Blazor Web App, accounting for the app's render mode. USE WHEN the user needs [Authorize] on pages, AuthorizeView, role or policy-based access, login/logout Identity pages, or AuthenticationStateProvider. Also USE WHEN auth state is null after WebAssembly loads, SignInManager throws in an interactive component, NotAuthorized content never renders in static SSR, or HttpContext.User is null in an interactive component. DO NOT USE for general component authoring (see…

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR, covering Accounting and bookkeeping. It works with Blazor, WebAssembly and ASP.NET Core. The repository describes itself as: Repository for skills to assist AI coding agents with .NET and C. The licence is MIT.

When your agent uses it

  • The user needs [Authorize] on pages
  • Policy-based access
  • Login/logout Identity pages
  • AuthenticationStateProvider

Example prompts

  • “/configure-auth”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Read AGENTS.md
  2. Register auth services in Program.cs
  3. Wire App.razor for auth and render mode
  4. Protect pages and components
  5. Identity pages must stay static SSR
  6. Auth state in WebAssembly / Auto mode

What it can do on your machine

Read from SKILL.md and the folder at commit 8d670fa. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are razor and csharp).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Configure Auth loads about 1.8k tokens when it runs. Until then it costs about 172 tokens; SKILL.md has 413 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~172
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from dotnet/skills at commit 8d670fa, republished under its MIT licence (© dotnet). 413 words, ~1,784 tokens.

Download SKILL.mdSave it as .claude/skills/configure-auth/SKILL.md (or your agent's skills folder).
name
configure-auth
description
Add authentication and authorization to a Blazor Web App, accounting for the app's render mode. USE WHEN the user needs [Authorize] on pages, AuthorizeView, role or policy-based access, login/logout Identity pages, or AuthenticationStateProvider. Also USE WHEN auth state is null after WebAssembly loads, SignInManager throws in an interactive component, NotAuthorized content never renders in static SSR, or HttpContext.User is null in an interactive component. DO NOT USE for general component authoring (see author-component), for prerendering concerns unrelated to auth (see support-prerendering), or for managing non-auth cascading state (see coordinate-components).
license
MIT

Configure Auth

Step 1 — Read AGENTS.md

Read AGENTS.md at the workspace root for the project's interactivity mode and scope before making changes.

Step 2 — Register auth services in Program.cs

csharp
// Program.cs (server project)
builder.Services.AddCascadingAuthenticationState();
builder.Services.AddAuthorization();

For ASP.NET Core Identity add the Identity services:

csharp
builder.Services.AddAuthentication(options =>
{
    options.DefaultScheme = IdentityConstants.ApplicationScheme;
    options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
})
.AddIdentityCookies();

builder.Services.AddIdentityCore<ApplicationUser>()
    .AddRoles<IdentityRole>()
    .AddEntityFrameworkStores<ApplicationDbContext>()
    .AddSignInManager()
    .AddDefaultTokenProviders();

Step 3 — Wire App.razor for auth and render mode

The App.razor component must use AuthorizeRouteView and conditionally apply the render mode so that pages excluded from interactive routing render statically.

razor
<!DOCTYPE html>
<html>
<head>
    <HeadOutlet @rendermode="RenderModeForPage" />
</head>
<body>
    <Routes @rendermode="RenderModeForPage" />
    <script src="_framework/blazor.web.js"></script>
</body>
</html>

@code {
    [CascadingParameter]
    public HttpContext HttpContext { get; set; } = default!;

    private IComponentRenderMode? RenderModeForPage =>
        HttpContext.AcceptsInteractiveRouting()
            ? InteractiveServer   // replace with the app's render mode
            : null;
}

In Routes.razor (or wherever the router lives), use AuthorizeRouteView:

razor
<Router AppAssembly="typeof(Program).Assembly">
    <Found Context="routeData">
        <AuthorizeRouteView RouteData="routeData"
                            DefaultLayout="typeof(Layout.MainLayout)">
            <NotAuthorized>
                @if (context.User.Identity?.IsAuthenticated != true)
                {
                    <RedirectToLogin />
                }
                else
                {
                    <p>You are not authorized to access this resource.</p>
                }
            </NotAuthorized>
        </AuthorizeRouteView>
        <FocusOnNavigate RouteData="routeData" Selector="h1" />
    </Found>
</Router>

Step 4 — Protect pages and components

[Authorize] attribute on pages
razor
@page "/admin"
@attribute [Authorize]

With roles or policies:

razor
@attribute [Authorize(Roles = "Admin")]
@attribute [Authorize(Policy = "RequireManager")]
AuthorizeView for conditional UI
razor
<AuthorizeView>
    <Authorized>Welcome, @context.User.Identity?.Name!</Authorized>
    <NotAuthorized><a href="Account/Login">Log in</a></NotAuthorized>
</AuthorizeView>

Role/policy variants:

razor
<AuthorizeView Roles="Admin,Manager">
    <Authorized>Admin content here</Authorized>
</AuthorizeView>
Access auth state in code
csharp
[CascadingParameter]
private Task<AuthenticationState>? AuthState { get; set; }

protected override async Task OnInitializedAsync()
{
    if (AuthState is not null)
    {
        var state = await AuthState;
        var isAdmin = state.User.IsInRole("Admin");
    }
}

Step 5 — Identity pages must stay static SSR

SignInManager and UserManager use HttpContext internally and throw in interactive components. Identity pages (login, register, manage) must render as static SSR.

In a globally interactive app, mark every Identity page:

razor
@page "/Account/Login"
@attribute [ExcludeFromInteractiveRouting]

This forces a full-page navigation (exits the interactive circuit) so the page renders through the static SSR pipeline with a real HttpContext.

App.razor must use AcceptsInteractiveRouting() (Step 3) to return null for these pages — otherwise the framework still tries to render them interactively.

In a per-page app, Identity pages are static by default (no @rendermode directive), so [ExcludeFromInteractiveRouting] is not needed.

Step 6 — Auth state in WebAssembly / Auto mode

WebAssembly components run in the browser and have no HttpContext. Auth state must be serialized from the server during prerendering and deserialized on the client.

Server Program.cs:

csharp
builder.Services.AddAuthenticationStateSerialization();

Client .Client/Program.cs:

csharp
builder.Services.AddAuthenticationStateDeserialization();

Without these calls, Task<AuthenticationState> resolves to an anonymous user after WebAssembly takes over from prerendering.

AddAuthenticationStateSerialization accepts options to include role and claim data:

csharp
builder.Services.AddAuthenticationStateSerialization(options =>
    options.SerializeAllClaims = true);
Show full SKILL.md (152 more words)Show less

Render Mode × Auth Matrix

Render modeHttpContext.UserSignInManagerAuth state sourceKey requirement
Static SSRAvailableWorksServer pipelineUse middleware for redirects, <NotAuthorized> does NOT render
Server (interactive)NOT availableThrowsCascadingAuthenticationStateUse [Authorize] + AuthorizeView, not HttpContext
WebAssemblyNOT availableThrowsSerialized from serverAddAuthenticationStateSerialization / Deserialization
AutoNOT available after WASMThrowsSerialized from serverSame as WebAssembly; register in both Program.cs files

Common Mistakes

MistakeSymptomFix
Using HttpContext.User in interactive componentNull or stale claimsUse [CascadingParameter] Task<AuthenticationState>
SignInManager in interactive componentInvalidOperationExceptionMove to static SSR page with [ExcludeFromInteractiveRouting]
Missing AddAuthenticationStateSerializationAnonymous user after WASM loadsAdd to server Program.cs; add Deserialization to client Program.cs
<NotAuthorized> in static SSR layoutContent never shownStatic SSR uses middleware pipeline; redirect via LoginPath or RedirectToLogin component
Global interactivity without AcceptsInteractiveRoutingIdentity pages crashAdd AcceptsInteractiveRouting() check in App.razor (Step 3)
Missing AddCascadingAuthenticationState()Task<AuthenticationState> is nullRegister in Program.cs (Step 2)

© dotnet, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/dotnet-blazor/skills/configure-auth of dotnet/skills.

Open the folder on GitHubat commit 8d670fa

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in dotnet/skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Configure Auth next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Configure Auth compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Configure Auth this skilldotnet/skills5.6k1 repos~1.8kAutomated safety check: PassMIT
Page Langsadobe/skills195—~1.1kAutomated safety check: PassApache-2.0
Chrome Devtools MCPmanagedcode/dotnet-skills486—~2.2kAutomated safety check: PassMIT
Aspnet Corefanslead/ReverseProxy.Store1632 repos~1.4kAutomated safety check: PassApache-2.0
Odoo Agency Fleet Reviewerpipe-org/mcp-odoo419—~699Automated safety check: PassMIT
Using Dotnetnovotnyllc/dotnet-artisan233—~2.3kAutomated safety check: WarnMIT

Similar skills

  • Page Langs

    adobe/skills

    Detect all languages used on a webpage — both declared (html@lang, hreflang alternate links, nested lang= attributes, meta content-language) and actually present in the body text (Google CLD3 via…

    195 GitHub stars~1.1k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Chrome Devtools MCP

    managedcode/dotnet-skills

    Use Chrome DevTools MCP from .NET agents and .NET-focused repos to inspect, debug, and automate Chrome through an MCP client.

    486 GitHub stars~2.2k tokensUpdated today
    DevelopmentAuto-check passed
  • Aspnet Core

    fanslead/ReverseProxy.Store

    Build, review, refactor, or architect ASP.NET Core web applications using current official guidance for .NET web development.

    163 GitHub starsUsed in 2 repos~1.4k tokens
    Backend & APIsAuto-check passed
  • Odoo Agency Fleet Review

    erpipe-org/mcp-odoo

    Review many client Odoo databases at once through odoo-mcp's cross-instance tools — fleet-wide accounting health, per-client aging, partial-failure triage — for agencies and partners managing 5–50…

    419 GitHub stars~699 tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Using Dotnet

    novotnyllc/dotnet-artisan

    Detects .NET intent for any C, ASP.NET Core, EF Core, Blazor, MAUI, Uno Platform, WPF, WinUI, SignalR, gRPC, xUnit, NuGet, or MSBuild request from prompt keywords and repository signals (.sln…

    233 GitHub stars~2.3k tokensUpdated 1 mo ago
    Backend & APIsAuto-check: warnings
  • Aspnet Core

    managedcode/dotnet-skills

    Build, debug, modernize, or review ASP.NET Core applications with correct hosting, middleware, security, configuration, logging, and deployment patterns on current .NET.

    486 GitHub stars~2.1k tokensUpdated today
    Backend & APIsAuto-check passed

More from dotnet/skills

All 91 skills in this repo
  • Official

    Resolves .NET runtime frames in Apple .ips crash logs to function names, source files and line numbers using dSYM symbols, atos and the Microsoft symbol server.

    5.6k GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed
  • Official

    Resolves native crash frames from .NET Android tombstones to function names, source files and line numbers using BuildIds, Microsoft's symbol server and llvm-symbolizer.

    5.6k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Official

    Scans C# and .NET code for about 50 performance anti-patterns and reports prioritized findings with concrete fixes, at a scan depth you choose.

    5.6k GitHub starsUsed in 3 repos~3.1k tokens
    Auto-check passed
  • Official

    Statically pairs source files with test files to list code that no test references, using Roslyn for C# or tree-sitter for many languages, with no build.

    5.6k GitHub starsUsed in 1 repo~3.3k tokens
    Auto-check passed
  • Microbenchmarking

    dotnet/skills

    Official

    Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks.

    5.6k GitHub starsUsed in 3 repos~3.3k tokens
    Auto-check passed
  • Official

    Makes .NET projects compatible with Native AOT and trimming by resolving IL trim and AOT analyzer warnings through annotations rather than suppressions.

    5.6k GitHub starsUsed in 2 repos~4.2k tokens
    Auto-check passed

Questions about Configure Auth

What does Configure Auth do?

Add authentication and authorization to a Blazor Web App, accounting for the app's render mode. Configure Auth is an agent skill from dotnet/skills, published by the product's own GitHub organization. Add authentication and authorization to a Blazor Web App, accounting for the app's render mode.

When should I use Configure Auth?

Configure Auth fits situations like: the user needs [Authorize] on pages; policy-based access; login/logout Identity pages; authenticationStateProvider.

How do I install Configure Auth in Claude Code?

Run `npx skills add dotnet/skills --skill configure-auth -a claude-code`. Or copy the skill folder (plugins/dotnet-blazor/skills/configure-auth in dotnet/skills) into .claude/skills/configure-auth in your project. Claude Code loads it when a task matches its description.

How do I install Configure Auth in Codex?

Run `npx skills add dotnet/skills --skill configure-auth -a codex`. Or copy the skill folder (plugins/dotnet-blazor/skills/configure-auth in dotnet/skills) into .agents/skills/configure-auth in your project. Codex loads it when a task matches its description.

Can I use Configure Auth in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add dotnet/skills --skill configure-auth -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/configure-auth, .gemini/skills/configure-auth, .github/skills/configure-auth and .opencode/skills/configure-auth in your project.

What does Configure Auth need to run?

SKILL.md names no scripts, command-line tools or credentials: Configure Auth is instructions for the agent only.

Does Configure Auth access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Configure Auth safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Configure Auth use?

Configure Auth is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Configure Auth use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Configure Auth?

Skills that share tags, products or a category with Configure Auth: Page Langs (adobe/skills, 195 stars), Chrome Devtools MCP (managedcode/dotnet-skills, 486 stars), Aspnet Core (fanslead/ReverseProxy.Store, 163 stars) and Odoo Agency Fleet Review (erpipe-org/mcp-odoo, 419 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Configure Auth?

dotnet (a GitHub organization, an official publisher) maintains it in dotnet/skills, which has 5,568 GitHub stars. The repository holds 91 skills in this directory. The repository was last updated on October 7, 2026.

Source: dotnet/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.