Skip to content

Files

Latest commit

Jul 31, 2017
ddd8ebe · Jul 31, 2017

History

History
42 lines (29 loc) · 1.54 KB

README.md

File metadata and controls

42 lines (29 loc) · 1.54 KB

PHP Client Credentials with Microsoft Graph

This is a very simple application example that implements getting any user's calendar using Azure Active Directory as the authentication provide. This practice is applicable for services or deamon apps. More technical details you may find on documentation. Keep in mind that you can use only 1.0 end-points. Should you use the v2.0 endpoint?

Preconditions

  • application created in Azure Active Directory,
  • granted permission (Read calendars in all mailboxes) by administrator for Microsoft Graph API (it's worth to mention that it must be Application Permission, not Delegated Permission),
  • prepared application id, secret, tenant id.

Quick start

Application was tested with PHP 7.1.

  • install dependencies

composer install

  • fill out a config-sample.yml file with your data
user_principal_name: [email protected] # app will fetch events for this guy
client_id: client_id
client_secret: client_secret
tenant_id: tenant_id
  • rename the config file to config.yml

  • launch a build-in web server

php -S 127.0.0.1:8000

  • visit localhost:8000 in your browser.