public async Task <ActionResult <AuthenticateResult> > Post([FromBody] AuthenticateRequest model) { var signInResult = await _signInService.CheckPasswordAsync(model.Email, model.Password); if (!signInResult.Result.Succeeded) { return(BadRequest(signInResult)); } var claims = new[] { new Claim(JwtRegisteredClaimNames.Sub, signInResult.User.Id), new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), new Claim(JwtClaimTypes.MemberId, signInResult.User.MemberId.ToString()) }; var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["Jwt:Key"])); var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); var token = new JwtSecurityToken(_configuration["Jwt:Issuer"], _configuration["Jwt:Issuer"], claims, expires: DateTime.Now.AddMinutes(20), signingCredentials: credentials); return(new AuthenticateResult { Jwt = new JwtSecurityTokenHandler().WriteToken(token) }); }