[solved]Stuck on a The input is not a valid Base-64 string error

Here is the full error message: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

The error shows up when I use my login endpoint when _signInManager.CheckPasswordSignInAsync manager is called.

 [HttpPost("login")]
 public async Task<IActionResult> Login(LoginDto loginDto)
 {
     if (!ModelState.IsValid)
         return BadRequest(ModelState);
     
     var user = await _userManager.Users.FirstOrDefaultAsync(x => x.Email == loginDto.Email);

     if (user == null)
         return Unauthorized("Invalid Email");

   
var result = await _signInManager.CheckPasswordSignInAsync(user, loginDto.Password,false);
    
 
     if (!result.Succeeded)
         return Unauthorized("Email or Password not found/incorrect");

     return Ok(
         new NewUserDto
         {
         
             Email = user.Email,
             Token = _tokenService.CreateToken(user)
         });
 }


Here are things I've tried:
  1. Encoding loginDto.Password into a base64 string
  2. Modifying thesigningkey, making it longer and shorter. Making sure it takes up 64 bytes.
The stack trace is too big for discord so it'll be in a comment

SOLUTION: The problem was that the password in the database wasn't encoded in base64
Was this page helpful?