Explain the role of the AuthenticationStateProvider. How does it notify the UI that the user's auth status has changed?

Last updated 5 July 2026

  • AuthenticationStateProvider is the single source of truth for the current user, consumed by AuthorizeView, CascadingAuthenticationState and [Authorize].

  • On login/logout it calls NotifyAuthenticationStateChanged with a new Task<AuthenticationState>, raising the AuthenticationStateChanged event.

  • CascadingAuthenticationState listens and re-cascades the new state, re-rendering dependent components. Custom providers (common in WASM) subclass it and call the notify method.

  • https://learn.microsoft.com/en-us/aspnet/core/blazor/security/authentication-state?view=aspnetcore-10.0
  • https://medium.com/careerbytecode/i-changed-the-users-role-but-blazor-didn-t-care-until-i-did-this-one-thing-bfc16fa708bd
  • https://www.youtube.com/watch?v=iq2btD9WufI
  • https://dev.to/auth0/securing-blazor-in-all-its-flavors-2819
All Blazor interview questions