Skip to content

Commit d2285a8

Browse files
author
Igor Drobiazko
committed
Now refreshing tokens again
1 parent b2fc325 commit d2285a8

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/triggers/contacts.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ function processAction(msg, cfg, snapshot) {
2121

2222
// Main loop
2323
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 });
3939

4040
const client = MicrosoftGraph.init({
4141
defaultVersion: 'v1.0',

0 commit comments

Comments
 (0)