I have this very simple “page”:
<html>
<head>
</head>
<body>Handling...
<script>
var token = location.hash.toString().substring("#access_token=".length, location.hash.indexOf("&"));
var t = "/ri/auth/fbLogin?token=" + encodeURIComponent(token);
console.log(t);
// t is now /ri/auth/fbLogin?token=blablablablablabla
setTimeout(function() {
window.location.href = t;
}, 2000);
</script>
</body></html>
For some reason, the script always redirects to itself first, but without the hash. That version of the script then redirects to the intended URL, but with an empty token.
I’ve tried window.location = t and window.navigate(t) as well, but no luck there. That timeout is also a failed attempt at getting it to work.
How silly. Turns out the script worked after all, but the page that it navigated to redirected back to the referrer.