I am performing Discord OAuth through a browser extension and have successfully performed the flow in Chrome and Firefox. However, I get a CORS error partway through the auth process in Microsoft Edge.
I have confirmed through Discord api docs' github that they have no CORS restriction on their server. When placing an authenticated GET request that returns 200 in Chrome, I get a 403 in Edge. I copy & paste the exact same fetch() request into the extension popup console, so there shouldn't be any experimental error. The request as it appears in the Chrome looks like so:
fetch("https://discord.com/api/users/@me", {
"headers": {
"accept": "*/*",
"accept-language": "en-US,en;q=0.9",
"authorization": "Bearer [redacted]",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"sec-gpc": "1"
},
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "cors",
"credentials": "include"
});
I'm able to place this same request in the browser console of any Edge tab that isn't an Edge add-on, and it successfully returns 200 with body data. Only in the Edge add-on does the request fail. Here's an image of the failure message.
Does anyone have experience with CORS errors in Edge add-ons? I doubt the error is related to Discord specifically, but I suppose that could be possible.