function checkToken(){ instance.get("token", { withCredentials: true}) .then(function(response) { location.href="html/home.html"; }) .catch(function(error){ location.href="/"; }); }