This code is a copy found in the examples on Office development. I've added a Dockerfile here so that this code can run from a docker container. This code is linked to https://hub.docker.com/r/rickvanrousselt/graphconnector/ where after a commit it will automatically build a new docker image.
The sample uses the v2.0 authentication endpoint, which enables users to sign in with either their personal or work or school Microsoft accounts.
Note: For an in-depth look at the code for calling the Microsoft Graph API in a Node.js app, see Call Microsoft Graph with a Node.js app.
To use the Office 365 Node.js Connect sample, you need the following:
- Either a Microsoft or Office 365 for business account.
- Node.js version 4 or 5.
##Register and configure the app
-
Sign into the App Registration Portal using either your personal or work or school account.
-
Select Add an app.
-
Enter a name for the app, and select Create application.
The registration page displays, listing the properties of your app.
-
Under Platforms, select Add platform.
-
Select Web.
-
Add the following to the list of Redirect URIs:
http://localhost/login
-
Under Application Secrets click Generate New Password.
-
Copy the New password generated and Application Id, you'll need them in the next section.
-
Click Save.
- Update
authHelper.js/client_id
with your application id - Update
authHelper.js/client_secret
with your password
To run the app, type the following into your command line:
docker run -d -p 80:3000 rickvanrousselt/graphconnector
Once the application server has been started, open your web browser to http://localhost