private string GetEncodedJwt(AccountModel account, ClaimsIdentity identity) { var token = new JwtSecurityToken( issuer: AuthOptions.Issuer, audience: AuthOptions.Audience, notBefore: AuthOptions.GetNotBefore(), claims: identity.Claims, expires: AuthOptions.GetExpires(), signingCredentials: new SigningCredentials(AuthOptions.GetSymmetricSecurityKey(), SecurityAlgorithms.HmacSha256) ); var accountInfoModel = _account.GetAccountInfo(account); var encodedJwt = new JwtSecurityTokenHandler().WriteToken(token); accountInfoModel.Token = encodedJwt; return(encodedJwt); }