Die richtige Antwort ist dieses Tutorial zu folgen: https://competenepal.com/lets-make-a-facebook-login-system-in-electron-that-actually-works/
musste ich nur diesen Teil implementieren:
var options = {
client_id: '',
scopes: "public_profile",
redirect_uri: "https://www.facebook.com/connect/login_success.html"
};
var authWindow = new BrowserWindow({ width: 450, height: 300, show: false,
parent: mainWindow, modal: true, webPreferences: {nodeIntegration:false} });
var facebookAuthURL = "https://www.facebook.com/v2.8/dialog/oauth?client_id=" + options.client_id + "&redirect_uri=" + options.redirect_uri + "&response_type=token,granted_scopes&scope=" + options.scopes + "&display=popup";
authWindow.loadURL(facebookAuthURL);
authWindow.show();
authWindow.webContents.on('did-get-redirect-request', function (event, oldUrl, newUrl) {
var raw_code = /access_token=([^&]*)/.exec(newUrl) || null;
var access_token = (raw_code && raw_code.length > 1) ? raw_code[1] : null;
var error = /\?error=(.+)$/.exec(newUrl);
if(access_token) {
FB.setAccessToken(access_token);
FB.api('/me', { fields: ['id', 'name', 'picture.width(800).height(800)'] }, function (res) {
console.log('response is:', res);
});
authWindow.close();
}
});