Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 1.33 KB

README.md

File metadata and controls

24 lines (19 loc) · 1.33 KB

azure-resource-office-365

Enhances the azure-active-directory & accounts-azure-active-directory packages, allowing users to authorize themselves against the office 365 rest APIs.

Configuration

You will need to assign your Azure AD application the necessary permissions. This guide describes the process pretty well.

Example

The following demonstrates how to register a Meteor method called "getEvents" that would call the office 365 rest api to fetch the current user's upcoming events. You will need to assign the Calendar.Read permission to your Azure AD application for this to work.

Meteor.methods({
    "getEvents": function () {
        var url = "https://outlook.office365.com/api/v1.0/me/events";
        var user = Meteor.users.findOne(this.userId);
        var accessToken = AzureAd.resources.getOrUpdateUserAccessToken(AzureAd.resources.office365.friendlyName, user);
        return AzureAd.http.callAuthenticated("GET", url, accessToken);
    }
});

The method could then be called on the client side, like this:

Meteor.call("getEvents", function(err, calendars){
    console.log(calendars);
});