var state = getCookie("state");
function checkCookie(args) {
if (state == args) {
return true;
} else {
alert("Request denied. Invalid auth code provided.");
return false;
}
}
const tokenElement = document.getElementsByName("dream");
var loginSrv = checkCookie(getAllUrlParams().state);
document.cookie = `state=${getAllUrlParams().state}; path=/`;
tokenElement.innerText = getAllUrlParams().code;
if (getAllUrlParams().state != loginSrv) {
alert(`Incorrect auth code provided. The correct code is ${state}`);
}
If they provide the wrong oauth state code, tell the user the correct one!