Skip to content

Commit 5b8678d

Browse files
authoredAug 31, 2019
Merge pull request #1121 from jakejarrett/bugfix/use-electron-5
Update code to support electron 5 & fixes login bug
2 parents e2107d2 + d871047 commit 5b8678d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
 

‎main.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,18 @@ function authenticateUser() {
5454

5555
contents = authenticationWindow.webContents;
5656

57-
contents.on('did-get-redirect-request', (event, oldUrl, newUrl) => {
57+
contents.on('did-navigate', (_event, url, httpResponseCode) => {
5858
const access_tokenStr = 'access_token=';
5959
const expires_inStr = '&expires_in';
6060
let accessToken;
6161

62-
if (newUrl.indexOf('access_token=') < 0) {
62+
if (url.indexOf('access_token=') < 0) {
6363
return false;
6464
}
6565

66-
accessToken = newUrl.substring(newUrl.indexOf(access_tokenStr) + 13, newUrl.indexOf(expires_inStr));
66+
accessToken = url.substring(url.indexOf(access_tokenStr) + 13, url.indexOf(expires_inStr));
67+
68+
accessToken = accessToken.split('&scope=')[0];
6769

6870
setUserData(accessToken);
6971
authenticationWindow.destroy();
@@ -93,7 +95,10 @@ function initMainWindow() {
9395
minWidth: 800,
9496
minHeight: 640,
9597
center: true,
96-
frame: false
98+
frame: false,
99+
webPreferences: {
100+
nodeIntegration: true
101+
}
97102
});
98103

99104
mainWindow.loadURL(`file://${__dirname}/app/index.html`);

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"babel-preset-react": "^6.23.0",
3232
"babel-preset-stage-0": "^6.22.0",
3333
"babel-register": "^6.23.0",
34-
"electron": "^1.6.11",
34+
"electron": "^6.0.6",
3535
"electron-packager": "^8.5.1",
3636
"eslint": "^4.0.0",
3737
"eslint-plugin-react": "^7.1.0",

0 commit comments

Comments
 (0)
Failed to load comments.