.Net 6 Blazor not using CustomAuthStateProvider
BlueWaterCrystal opened this issue · 4 comments
BlueWaterCrystal commented
Hi,
I can't seem to get C# Blazor (.Net 6) to work.
It doesn't seem to use CustomAuthStateProvider so .User.Identity.IsAuthenticated
always returns false.
if I change AuthenticationStateProvider in AuthService.cs to CustomAuthStateProvider, it can authenticate but then the pages can't detect it so returns unauthenticated.
builder.Services.AddScoped<AuthenticationStateProvider, CustomAuthStateProvider>(
provider => new CustomAuthStateProvider(
provider.GetRequiredService<ILocalStorageService>(),
provider.GetRequiredService<Supabase.Client>(),
provider.GetRequiredService<ILogger<CustomAuthStateProvider>>()
)
);
acupofjose commented
@rhuanbarros could you give your thoughts?
BlueWaterCrystal commented
Services were in the wrong order in the program.cs
rhuanbarros commented
@rhuanbarros could you give your thoughts?
I got here too late. 🥲
acupofjose commented
Ha! No worries - thanks for being here!