Is it possible for an HTML5 game hosted on itch.io to access the query parameters with which the main itch.io page was opened?
I see this asked in a lot of threads, but there are either no replies, or in one case a 6-year-old answer that seems to say it's possible, but I can't see how.
My game ( https://whalebunny.itch.io/civ-hero ) needs to do standard OAuth2 authentication in my game to let the user sign in to other services (in my case Discord) for some game features. I redirect to the authorization page and it redirects back. When the auth process redirects back to itch.io, I have been able to get the auth query strings from document.referrer (from JavaScript) in Chrome, and have everything work. A player can play the game on itch.io and the game can interact with Discord.
But this doesn't work with Firefox. document.referrer has lost the query string by the time the game runs (from the player clicking on the "Run Game" button again).
window.location.ref: Has no query strings in either Chrome or Firefox
document.referrer: OK in Chrome, but does not have query strings in Firefox
window.parent.location: Has what I want, but is not accessible (cross-origin) from iframe
window.parent.document: Also not accessible (cross-origin) from iframe
In this thread https://itch.io/t/222066/query-strings-for-embedded-games , @leafo says you should be able to access the URL of the parent itch.io page, but if this was possible 6 years ago, I don't see how today.
Help! How can I get query strings inside the iframe, or how can I otherwise authenticate with external services?