dotnet-presentations / blazor-workshop

Blazor workshop
https://aka.ms/blazorworkshop
MIT License
3.47k stars 1.54k forks source link

Authentication issue #358

Open objetitos opened 1 year ago

objetitos commented 1 year ago

Hello. I am using VS2022 with NET 7.0 I followed the workshop ok from 00-get-started up to 06-authentication. I couldn't get the AuthorizeView component to show up properly (only showed the three dots).
Afte debugging, it turns out I need to explicitly add [JsonSerializable(typeof(Dictionary<string,string>))] to the list in Order.cs. Otherwise, after the call to _configuration/{clientId} the serializer returns null, resulting in the exception.

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Could not load settings from '_configuration/BlazingPizza.Client'
createUserManager@https://localhost:5001/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:290604
Microsoft.JSInterop.JSException: Could not load settings from '_configuration/BlazingPizza.Client'
createUserManager@https://localhost:5001/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js:2:290604

Regards, Miguel

gerardvwe commented 1 year ago

Great find, had the same issue with VS2022 and NET 7.0.

nicholasyin commented 1 year ago

Just wanna say thank you, and btw put some down thumbs to the repo maintainer.

nerem commented 1 year ago

Thank you! Also fixed https://github.com/dotnet-presentations/blazor-workshop/issues/360 for me