Skip to content

GetAuthenticationStateAsync() should not be called automatically on [AllowAnonymous] pages #62217

Open
@mckaragoz

Description

@mckaragoz

Summary

Currently, the AuthenticationStateProvider.GetAuthenticationStateAsync() method is invoked automatically on all pages, including those marked with [AllowAnonymous]. This leads to unnecessary token validations and refresh attempts even on pages that don't require authentication. This results in performance overhead, unwanted UI states like "Authorizing...", and possible JS interop issues during static rendering.

Proposal:

Provide a built-in way to skip or delay the GetAuthenticationStateAsync() call for anonymous pages, or allow developers to control when and where the authentication state is evaluated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-authIncludes: Authn, Authz, OAuth, OIDC, Bearerdesign-proposalThis issue represents a design proposal for a different issue, linked in the description

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions