简体   繁体   中英

How to fix auth error in Blazor WASM .NET 7 upgrade?

Ever since I updated my blazor wasm project which is hosted as a static site on azure to.Net 7, users have been getting redirected to "______.com/authentication/login-failed" even though the authentication is working properly. They can then navigate around the site with out issue, but not without seeing this error.

I can't reproduce this problem locally (only happens in azure production environment), and the only error I get is a 404 not found.

"Failed to load resource: the server responded with a status of 404 (The requested content does not exist.)"

Has anyone else experienced this, and hopefully found a solution?

I could roll back to.Net 6, but that had a ton of other authentication related problems, which.Net7 had fixed.

Adding the following to the client.csproj should fix it:

<ItemGroup>
    <TrimmerRootAssembly Include="Microsoft.Authentication.WebAssembly.Msal" />
    <TrimmerRootAssembly Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" />
</ItemGroup>

source https://github.com/do.net/as.netcore/issues/44981

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM