ada-blazor-wasm-api-integration

Diagnose and fix Blazor WASM to ASP.NET Core API integration failures.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/wubing7755/Ada --skill ada-blazor-wasm-api-integration-wubing7755
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ada-blazor-wasm-api-integration
Source: https://github.com/wubing7755/Ada/tree/main/skills/software-development/ada-blazor-wasm-api-integration
Command: npx skills add https://github.com/wubing7755/Ada --skill ada-blazor-wasm-api-integration-wubing7755

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Blazor WASM frontends calling a separate ASP.NET Core backend hit recurring, hard-to-diagnose failures: startup crashes from manual DelegatingHandler chains, relative API paths silently resolving to the frontend origin, dev-server ETag caching of runtime config, stale session caches after admin writes, and browser tests that render pages without exercising the real interaction path. ## Core Features & Use Cases - Pitfall catalog with fixes: Eight verified pitfalls covering auth header injection, URL resolution, mode-config caching, @bind blur behavior, net6.0 test constraints, session-cache staleness, and display-precedence shadowing. - Verification discipline: A checklist enforcing that every cross-backend call goes through one URL resolver, regression tests assert the request host, and browser verification performs the actual critical-path operation. - Use Case: A user's login fails with valid credentials and the backend log shows no request. The Skill identifies that a relative api/ path resolved to the frontend origin, prescribes a central URL resolver, and adds a host-asserting regression test. ## Quick Start Ask the agent to diagnose why your Blazor WASM login or comment calls fail against the backend API and apply the integration pitfall fixes.

Frequently Asked Questions about ada-blazor-wasm-api-integration

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

FAQPage Schema
Why does my Blazor WASM app crash at startup with a DelegatingHandler?

Manually constructing HttpClient with a DelegatingHandler leaves InnerHandler null in WASM, since there is no HttpClientFactory to chain it. Instead, have the auth service set DefaultRequestHeaders.Authorization directly on a shared singleton HttpClient.

Why do Blazor WASM API calls never reach the backend server?

Relative paths like api/posts resolve against HttpClient.BaseAddress, which is the frontend origin, so the request never leaves the frontend. Route every cross-backend call through one URL-resolving service that prefixes the configured apiBaseUrl.

How do I attach a JWT Authorization header in Blazor WASM?

Set DefaultRequestHeaders.Authorization on the shared HttpClient from your auth service whenever the token changes, using AuthenticationHeaderValue with the Bearer scheme. Public endpoints simply ignore the header, so no per-request handler chain is needed.

Why does editing wwwroot config.json not change Blazor WASM behavior?

The ASP.NET Core dev server serves wwwroot files with ETags, so the browser reuses the cached response. Restart the dev server or use a cache-busting query, and verify what the browser actually receives rather than what curl shows.

Why does a Blazor WASM page show stale content after an admin edit?

AddScoped in Blazor WASM behaves as a session-long singleton, so cached content sources serve stale data after writes through another path. Drop session caching for mutable backend data and re-read from the API, which is the single source of truth.

Can net6.0 Blazor tests use C# 11 raw string literals?

No. SDK 6.0.x ships the C# 10 compiler, so raw string literals produce CS8652 even with LangVersion=latest. Write test JSON as escaped interpolated strings instead.