我有一个运行 Net 6 Preview 4 的简单 Blazor WASM,我使用本指南进行设置:
https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-azure-active-directory?view=aspnetcore-6.0
确切的代码适用于 Net 5.0(使用相应的 Net 5.0 程序集)
但是,当我升级到 Net 6 时,我收到以下身份验证错误:
There was an error trying to log you in: 'Cannot read property 'toLowerCase' of undefined'
我似乎也无法获得更多细节。这是在 Azure 应用服务自包含发布上发布的。代码可以在这里找到:
https://github.com/aherrick/BlazorWASM.Net6Prev4.AzureAD
最佳答案
此处讨论了该问题的解决方法:
https://github.com/dotnet/aspnetcore/issues/33312 .
简而言之,问题是由装配修整引起的。解决方法是排除 Microsoft.Authentication.WebAssembly.Msal
通过将其包含在客户端项目文件中来进行修剪:
<ItemGroup>
<TrimmerRootAssembly Include="Microsoft.Authentication.WebAssembly.Msal" />
</ItemGroup>
关于c# - Blazor WASM Net 6 Preview 4 Azure AD - 尝试登录时出错 : 'Cannot read property ' toLowerCase' of undefined',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67805062/