public IActionResult Authenticate(PrincipalCreateDTO principal) { try { var role = authenticationHelper.AuthenticatePrincipal(principal); principal.Role = role.Role; // principal.Role = role; var tokenString = authenticationHelper.GenerateJwt(principal); return(Ok(new { token = tokenString, role = role })); } catch (Exception e) { return(Unauthorized()); } }