How does Blazor handle authentication and authorization differently in Server vs. WASM?
Last updated
Both models share the same authorization APIs (
AuthorizeView,[Authorize], policies) fed by anAuthenticationStateProvider.Blazor Server uses a standard ASP.NET Core auth cookie whose identity flows to the circuit via
HttpContext. Checks and secrets stay on the server, so they are genuinely enforceable.WASM runs in the browser with no
HttpContextand typically uses OIDC/OAuth tokens stored client-side. Its checks are UI-only, so the backend API must validate the bearer token.
- https://gist.github.com/SteveSandersonMS/175a08dcdccb384a52ba760122cd2eda?permalink_comment_id=3301084
- https://learn.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-10.0
- https://blog.matrixpost.net/blazor-server-basics-part-5-authentication-and-authorization/
- https://www.reddit.com/r/Blazor/comments/vcv47s/blazor_server_vs_wasm/
- https://www.c-sharpcorner.com/article/understand-basic-of-authorization-in-blazor-server-app
- https://dev.to/auth0/securing-blazor-in-all-its-flavors-2819
- https://auth0.com/blog/auth0-authentication-blazor-web-apps/
- https://medium.com/c-sharp-programming/blazor-webassembly-vs-server-in-2025-the-ultimate-guide-to-choosing-your-perfect-hosting-model-d5af612fb87c