This is how I authenticate and sign in my user:
public void UserAuthentication(string email)
{
var claim = new List<Claim> { new Claim(ClaimTypes.Name, email) };
var identity = new ClaimsIdentity(claim, CookieAuthenticationDefaults.AuthenticationScheme);
var principal = new ClaimsPrincipal(identity);
HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal).Wait();
}
I want to ask, can this method fail? If so, how can I handle it?