Skip to content

GetAuthenticationStateAsync isn't invoked when navigating using enhanced navigation #61972

Closed
@grallbring

Description

@grallbring

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When navigating within my .NET 9 Blazor Server application, GetAuthenticationStateAsync of my custom AuthenticationStateProvider isn't invoked. I think my issue is related to #39929, where the conclusion was to "perform a check inside AuthenticationStateProvider" by @javiercn, which, as I understand it, I am doing and since this isn't working this might be a bug.

Expected Behavior

When navigating the Blazor Server application using links it should invoke GetAuthenticationStateAsync so I can verify that the user's session is still valid.

Steps To Reproduce

  • Add a custom AuthenticationStateProvider to the project.
  • GetAuthenticationStateAsync is invoked when the user first visits the application or triggers a hard reload.
  • GetAuthenticationStateAsync is not invoked when clicking a link, thus using enhanced navigation.

Exceptions (if any)

No response

.NET Version

9.0.300

Anything else?

.NET SDK:
 Version:           9.0.300
 Commit:            15606fe0a8
 Workload version:  9.0.300-manifests.af4147de
 MSBuild version:   17.14.5+edd3bbf37

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26100
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.300\

.NET workloads installed:
 [ios]
   Installation Source: VS 17.14.36109.1
   Manifest Version:    18.4.9288/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.4.9288\WorkloadManifest.json
   Install Type:              Msi

 [maui-windows]
   Installation Source: VS 17.14.36109.1
   Manifest Version:    9.0.51/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.51\WorkloadManifest.json
   Install Type:              Msi

 [maccatalyst]
   Installation Source: VS 17.14.36109.1
   Manifest Version:    18.4.9288/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.4.9288\WorkloadManifest.json
   Install Type:              Msi

 [android]
   Installation Source: VS 17.14.36109.1
   Manifest Version:    35.0.61/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.61\WorkloadManifest.json
   Install Type:              Msi

Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.5
  Architecture: x64
  Commit:       e36e4d1a8f

.NET SDKs installed:
  9.0.300 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issueStatus: No Recent Activityarea-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions