Reputation: 11
I'm trying to create an Electron app (using Electron.net and MVC) with user sign-ins using Discord's OAuth2. However when loading up the OAuth2 page, Discord thinks that I'm using a broken installation of Discord. I assume that this is because the Discord desktop application also uses Electron. When not using Electron, the link opens fine.
So far I've attempted changing the User-Agent (both in the Electron startup code and directly on the link with Javascript) used by Electron as I believed that this was how Discord was identifying the app as using Electron, however this hasn't worked. Does anyone know how else Discord might be working out that I'm using Electron and how I might get around it?
Upvotes: 0
Views: 1641
Reputation: 11
I had to deal with the same issue, so I enabled devtools on load. I found this script here (https://discordapp.com/assets/db6c3ddb51620cee5d94.js) where they handle the app events, and I realized that they were loading node modules, which would not be available in a browser setting. The solution is to set nodeIntegration: false
in the window options like so:
authWindow = new BrowserWindow({
width: 800,
height: 500,
frame: false,
webPreferences: {
nodeIntegration: false
}
});
Upvotes: 1