Skip to content

Blazor Web App with EntraID does not refresh auth after token expires #64360

@Harl3

Description

@Harl3

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a blazor web app with only interactive webassembly mode (prerendering disabled) secured with Entra ID as per https://learn.microsoft.com/en-us/aspnet/core/blazor/security/blazor-web-app-with-entra?view=aspnetcore-10.0&pivots=non-bff-pattern I'm using the NON bff pattern and without a downstream api.
My issue is that when the authentication token expires (default is roughly 1 hour) api calls just start giving errors with 301 found redirecting to the Entra login page. I would expect the auth state to refresh without giving errors.
My understanding is that Blazor wasm is not able to refresh auth state without a full page reload, so how should i handle this situation? Strangely i didn't find any documentation on this that i consider a pretty standard use case (maybe i didn't look well enough), so i guess i'm considering this a bug in the sample docs/app?
many thanks

Expected Behavior

Authentication state should gracefully refresh itself without backend api errors

Steps To Reproduce

Clone https://github.com/dotnet/blazor-samples/tree/main/10.0/BlazorWebAppEntra and run it.
login and then wait for the token to expire

Exceptions (if any)

No response

.NET Version

10.0.0

Anything else?

No response

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.Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.area-authIncludes: Authn, Authz, OAuth, OIDC, Bearer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions