0

I am implementing asp.net.Identity.Mongo 6.7, i have an issue that when i sign in when a user have no roles the sign in works but when i add roles, i try to authenticate the user i get "Value cannot be null" exception

my signin method:

 public async Task<IActionResult> Login(UserLoginDto userLoginDto)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(userLoginDto.Email);              
               var result = await _signInManager.PasswordSignInAsync(user, userLoginDto.Password, false, false);
                if (result.Succeeded)
                    return Ok(new
                    {
                        token = GenerateJwtTokenAsync(user)
                    });
                else if (result.IsNotAllowed)
                {
                    Console.WriteLine(result);
                }    
            }
            re

i want to know why the login works when the user has no roles and it doesnt when he does.

0 Answers0