I'm using dotnet add package supabase-csharp as a c# client.
I'm signed in var session = await supabase.Auth.SignIn(email, password); successfully, but when i tried to get the current user or session it get back as null:
var currentSession = _supabase.Auth.CurrentSession;
var currentUser = _supabase.Auth.CurrentUser;
The configuration:
builder.Services.AddScoped<Supabase.Client>(_ =>
new Supabase.Client(
builder.Configuration["SUPABASE_URL"],
builder.Configuration["SUPABASE_KEY"],
new SupabaseOptions
{
AutoRefreshToken = true,
AutoConnectRealtime = true,
}));
Any hints related to this?
var session = await _supabase.Auth.SignIn(email, password); if (session != null) { var currentSession = _supabase.Auth.CurrentSession; var currentUser = _supabase.Auth.CurrentUser; }signup,signin,signout. And another controller for :currentsession,currentuser,update. Sample: [HttpGet("currentuser")] public IActionResult GetCurrentUser() { try { var currentUser = _supabase.Auth.CurrentUser; return Ok(currentUser); } catch (Exception ex) { return BadRequest(new { Error = $"Error getting current user: {ex.Message}" }); } }