Hello,
I need to know if theres a way of validate the token once u saved it in localStorage.
Right now im creating tokens with a certain duration (lets say 1day) and using them directly on the webservice.
So i need to know once u save it in a localStorage var how to validate if the token is already expired or not.
I was thinking to do this through ajax but i cannot figure out how to do it.
Until now i have something like this, i hope u guys can help me 
function tokenValidator(t){
const exampleUrl = "http://myserver/arcgis/rest/services/mylayer/sufolder/MapServer";
const datat = {
token: t
};
console.log(t);
$.ajax({
url: exampleUrl,
dataType: 'json',
data: datat
})
.done(isDone => {
console.log(isDone);
console.log("the token is still valid");
})
.fail(error => {
console.log(error);
console.log("token is not valid, redirect to login page");
});
}