public static async Task <string> GenerateJwt(ClaimsIdentity identity, IJwtProvider jwtFactory, string email, JwtIssuerOptions jwtOptions, JsonSerializerSettings serializerSettings) { var response = new { id = identity.Claims.Single(c => c.Type == "id").Value, auth_token = await jwtFactory.GenerateEncodedToken(email, identity), expires_in = (int)jwtOptions.ValidFor.TotalSeconds }; return(JsonConvert.SerializeObject(response, serializerSettings)); }