Skip to content

Blazor Server - NotAuthorized content is shown before Authorization is finished #43492

@human705

Description

@human705

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When loading Blazor Server with an authenticated user, the contents of NotAuthorized is briefly shown before the content switches over to Authorized. I've tested that with both and @Attribute [Authorize].

Expected Behavior

The contents of Authorizing should be shown before the authentication of the user can be verified.

Steps To Reproduce

I created a small project with 2 test files, test and test2. After authenticating, credentials are in MockUserRepository.cs, the user will be redirected to /test. This page is using the "@Attribute [Authorize] to secure the content. "If you refresh the page, you can briefly see the contents of the App.razor displayed before the page is rendered.

Click the menu option for test2 to see the issue when using "" . If you refresh the page after authenticating, you will again see the contents of "" before the page shows the "" content.

Exceptions (if any)

None at this time.

.NET Version

C:\Users\peter>dotnet --version 6.0.400

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions