supabase-community/supabase-csharp

.Net 6 Blazor not using CustomAuthStateProvider

BlueWaterCrystal opened this issue · 4 comments

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>>()
    )
);

@rhuanbarros could you give your thoughts?

Services were in the wrong order in the program.cs

@rhuanbarros could you give your thoughts?

I got here too late. 🥲

Ha! No worries - thanks for being here!