solved session problem. added withCredentials, few corrections here and there