-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
43 lines (36 loc) · 994 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const electronOauth2 = require('electron-oauth2');
var menubar = require('menubar');
var mb = menubar();
var config = {
clientId: '6777100542.apps.bexio.com',
clientSecret: 'FfdjCu3Q3Rp8Ujmcch2iFGHJC3o=',
authorizationUrl: 'https://office.bexio.com/oauth/authorize',
tokenUrl: 'https://office.bexio.com/oauth/access_token',
useBasicAuthorizationHeader: false
};
let scopes = [
'article_show',
'calendar_show',
'contact_show',
'lead_show',
'task_show'
];
mb.on('ready', () => {
const windowParams = {
alwaysOnTop: true,
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: false
},
closable: false
}
const options = {
scope: scopes.join('%20'),
state: Math.random().toString(36).substring(7)
};
const myApiOauth = electronOauth2(config, windowParams);
myApiOauth.getAccessToken(options)
.then(token => {
console.log(token);
});
});