public async Task <string> LoginAsync([FromBody] UserLoginModel loginModel, CancellationToken cancellationToken) { var userId = await _accountService.LoginAsync(loginModel, cancellationToken).ConfigureAwait(false); var userToken = _jwtTokenService.GenerateJwtTokenAsync(userId); return(JsonConvert.SerializeObject(new JwtSecurityTokenHandler().WriteToken(userToken))); }
public async Task <IActionResult> GenerateJwtTokenAsync([FromBody] GenerateJwtTokenRequestDto model) { var claims = await jwtTokenService.GenerateClaimsAsync(new List <Jwt.Models.ClaimDto>() { new Jwt.Models.ClaimDto() { Type = "Email", Value = model.Email.Trim() } }); var jwtToken = await jwtTokenService.GenerateJwtTokenAsync(claims, Jwt.Models.Algorithms.HmacSha256Signature); return(Ok(jwtToken)); }