@@ -21,21 +21,21 @@ function processAction(msg, cfg, snapshot) {
21
21
22
22
// Main loop
23
23
co ( function * mainLoop ( ) {
24
- // console.log('Refreshing an OAuth Token');
25
- // const newToken = yield rp({
26
- // method: 'POST',
27
- // uri: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
28
- // json: true,
29
- // form: {
30
- // refresh_token: cfg.oauth.refresh_token,
31
- // scope: 'openid offline_access calendars.read contacts.read user.read' ,
32
- // grant_type: 'refresh_token',
33
- // client_id: process.env.MSAPP_CLIENT_ID,
34
- // client_secret: process.env.MSAPP_CLIENT_SECRET
35
- // }
36
- // });
37
- // console.log('Updating token');
38
- // this.emit('updateKeys', { oauth: newToken });
24
+ console . log ( 'Refreshing an OAuth Token' ) ;
25
+ const newToken = yield rp ( {
26
+ method : 'POST' ,
27
+ uri : 'https://login.microsoftonline.com/common/oauth2/v2.0/token' ,
28
+ json : true ,
29
+ form : {
30
+ refresh_token : cfg . oauth . refresh_token ,
31
+ scope : cfg . oauth . scope ,
32
+ grant_type : 'refresh_token' ,
33
+ client_id : process . env . MSAPP_CLIENT_ID ,
34
+ client_secret : process . env . MSAPP_CLIENT_SECRET
35
+ }
36
+ } ) ;
37
+ console . log ( 'Updating token' ) ;
38
+ this . emit ( 'updateKeys' , { oauth : newToken } ) ;
39
39
40
40
const client = MicrosoftGraph . init ( {
41
41
defaultVersion : 'v1.0' ,
0 commit comments