The MSGraph library wraps the O365 package, giving robots the ability to access the Microsoft Graph API programmatically.

Graph's API primarily authenticates via the OAuth 2.0 authorization code grant flow or OpenID Connect. This library exposes the OAuth 2.0 flow for robots to authenticate on behalf of users. A user must complete an initial authentication flow with the help of our OAuth Graph Example Bot.

For best results, register an app in Azure AD and configure it as so:

  • The type is "Web App".
  • Redirect URI should be https://login.microsoftonline.com/common/oauth2/nativeclient
  • The app should be a multi-tenant app.
  • Accounts in any organizational directory is checked.
  • Has relevant permissions enabled, check the Microsoft Graph permissions reference for a list of permissions available to MS Graph apps.