A better authentication factory