-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathoutlook.js
More file actions
16 lines (14 loc) · 821 Bytes
/
outlook.js
File metadata and controls
16 lines (14 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var authContext;
var authToken; // for use with creating an outlookClient later.
authContext = new O365Auth.Context();
authContext.getIdToken("https://outlook.office365.com/")
.then((function (token) {
authToken = token;
// The auth token also carries additional information. For example:
userName = token.givenName + " " + token.familyName;
}).bind(this), function (reason) {
console.log('Failed to login. Error = ' + reason.message);
});
// Once the authToken has been acquired, create an outlookClient. One place to do this is inside of the
// ".then" function callback of authContext.getIdToken(...) above.
var outlookClient = new Microsoft.OutlookServices.Client('https://outlook.office365.com/api/v1.0', authToken.getAccessTokenFn('https://outlook.office365.com'));