GithubHelp home page GithubHelp logo

jonathanhotono / nodejs-apponlytoken-rest-sample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoftgraph/nodejs-apponlytoken-rest-sample

0.0 2.0 0.0 22 KB

This sample shows how to connect a service or daemon app (written in Node.js) to the Microsoft Graph API.

License: MIT License

JavaScript 100.00%

nodejs-apponlytoken-rest-sample's Introduction

Microsoft Graph service app sample using Node.js

Build Status

The Microsoft Graph API allows applications to call the API without user impersonation, that is, without a user signing in, using an app-only access token. This sample demonstrates how to request an app-only access token and create an event on each user calendar in a tenant using Node.js.

Prerequisites

To use this sample, you need the following:

  • Node.js is required to run the app and to install dependencies (via npm).

  • An Office 365 account. You can sign up for an Office 365 Developer subscription that includes the resources that you need to start building Office 365 apps.

    Note: If you already have a subscription, the previous link sends you to a page with the message Sorry, you can’t add that to your current account. In that case, use an account from your current Office 365 subscription.

  • A Microsoft Azure tenant to register your application. Azure Active Directory (AD) provides identity services that applications use for authentication and authorization. A trial subscription can be acquired here: Microsoft Azure.

    Important: You also need to make sure your Azure subscription is bound to your Office 365 tenant. To do this, see the Active Directory team's blog post, Creating and Managing Multiple Windows Azure Active Directories. The section Adding a new directory will explain how to do this. You can also see Set up your Office 365 development environment and the section Associate your Office 365 account with Azure AD to create and manage apps for more information.

  • An application registered in Azure AD. The application must be granted the Read and write calendars in all mailboxes and Read directory data application permissions for the Microsoft Graph application. Add a web server application in Azure and grant the proper permissions to it.

Configure and run the app

  1. Using your favorite IDE, open config.js in the root directory.
  2. Replace ENTER_YOUR_CLIENT_ID with the client ID of your registered Azure application.
  3. Replace ENTER_YOUR_SECRET with a key generated on the Configure page of your app in the Microsoft Azure Management Portal.
  4. Replace ENTER_YOUR_TOKEN_ISSUING_ENDPOINT with the OAuth 2.0 token endpoint value found by clicking the View Endpoints button in the Azure Management Portal.
  5. Run npm install to install the app's dependencies.
  6. Run npm start to run the app.

Note: This app will iterate through all users in your tenant and create a calendar event on each of their calendars. The event will have the title "Microsoft Graph API discussion", will be 30 minutes long, and will be exactly 24 hours from when you run the app.

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.MD.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Questions and comments

  • Please log an issue in this repository with any feedback or questions about this sample.
  • Please ask questions about Microsoft Graph on Stack Overflow. Don't forget to tag your questions with [MicrosoftGraph] and [office365].

Additional resources

Copyright

Copyright (c) 2015 Microsoft. All rights reserved.

nodejs-apponlytoken-rest-sample's People

Contributors

andrewjmay avatar iambmelt avatar martellaj avatar ricalo avatar sethgr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.