The code provided in this article is for .NET 8.0. It has not been tested with .NET 9.0
Nevermind, I was missing AddCascadingAuthenticationState()
.
Cool! Thank you for sharing
So this means it’s working in .NET 9 as well, right?
Yes it does as long as you don’t forget the cascading authentication state
Hello Andrea, thanks for the article.
I only have one question related to the Blazor Web project. My Maui solution has 3 projects, the mobile the shared project and the web project (Blazor WASM). Currently only the Mobile works, but when I run the web I am getting error:
rit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Could not load type of field ‘Auth0.OidcClient.WebAuthenticatorBrowser+d__0:<>u__1’ (3) due to: Could not load file or assembly ‘Microsoft.Maui.Essentials, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies.
System.TypeLoadException: Could not load type of field ‘Auth0.OidcClient.WebAuthenticatorBrowser+d__0:<>u__1’ (3) due to: Could not load file or assembly 'Microsoft.Maui.Essentials, Version=1.0.0.0
In order to make the authentication to work for the web project on Blazor WebAssembly should I do the implemention with the traditional approach for Blazor WASM ? or there is a way to use the same logic for all ?
Thanks