title: UserManager.CheckPasswordAsync vs SignInManager.PasswordSignInAsync
body: <p>using asp net core identity - when user provides password and username to get a jwt token they post credentials to /api/token</p>
  
  <p>should my token controller method be using usermanager to check the password using the CheckPasswordAsync and if this passes return the token or should i use the signinmanager and call PasswordSignInAsync and then return token based on that result?</p>
  
  <p>I have seen examples of both and wondered what is benefit of each, is one way better than the other?</p>
  
  <p>Currently someone in my team has written the following:</p>
  
  <pre><code>[AllowAnonymous]
  [HttpPost]
  public async Task&lt;ActionResult&lt;User&gt;&gt; Post([FromBody]User model)
  {
      try
      {                                              
          var user = await _userManager.FindByNameAsync(model.Username);
          if (user == null)
              return StatusCode(StatusCodes.Status401Unauthorized, "Incorrect username or password");
  
          var passwordOK = await _userManager.CheckPasswordAsync(user, model.Password);
          if (!passwordOK)
              return StatusCode(StatusCodes.Status401Unauthorized, "Incorrect username or password");
  
          model.Id = user.Id;
          model.Name = user.DisplayName;
          model.Password = "";               
  
          int expiresIn;
          long expiresOn;
          model.Token = _authorisationService.GetJWTToken(model.Username, user.Id, out expiresIn, out expiresOn);
          model.ExpiresIn = expiresIn;
          model.ExpiresOn = expiresOn;
  
          return model;
      }
      catch (Exception)
      {
          // log the exception
          return StatusCode(StatusCodes.Status500InternalServerError);
      }
  }
  </code></pre>
  
  <p>but i think there are things in that that are not necessary.</p>