2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,18 @@ function authenticateUser() {
54
54
55
55
contents = authenticationWindow . webContents ;
56
56
57
- contents . on ( 'did-get-redirect-request ' , ( event , oldUrl , newUrl ) => {
57
+ contents . on ( 'did-navigate ' , ( _event , url , httpResponseCode ) => {
58
58
const access_tokenStr = 'access_token=' ;
59
59
const expires_inStr = '&expires_in' ;
60
60
let accessToken ;
61
61
62
- if ( newUrl . indexOf ( 'access_token=' ) < 0 ) {
62
+ if ( url . indexOf ( 'access_token=' ) < 0 ) {
63
63
return false ;
64
64
}
65
65
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 ] ;
67
69
68
70
setUserData ( accessToken ) ;
69
71
authenticationWindow . destroy ( ) ;
@@ -93,7 +95,10 @@ function initMainWindow() {
93
95
minWidth : 800 ,
94
96
minHeight : 640 ,
95
97
center : true ,
96
- frame : false
98
+ frame : false ,
99
+ webPreferences : {
100
+ nodeIntegration : true
101
+ }
97
102
} ) ;
98
103
99
104
mainWindow . loadURL ( `file://${ __dirname } /app/index.html` ) ;
Original file line number Diff line number Diff line change 31
31
"babel-preset-react" : " ^6.23.0" ,
32
32
"babel-preset-stage-0" : " ^6.22.0" ,
33
33
"babel-register" : " ^6.23.0" ,
34
- "electron" : " ^1.6.11 " ,
34
+ "electron" : " ^6.0.6 " ,
35
35
"electron-packager" : " ^8.5.1" ,
36
36
"eslint" : " ^4.0.0" ,
37
37
"eslint-plugin-react" : " ^7.1.0" ,
0 commit comments