[go: up one dir, main page]

Skip to content

An example Microsoft Graph PHP application with OAuth 2.0 client credentials flow.

License

Notifications You must be signed in to change notification settings

pdaw/php-microsoft-graph-clientcred

Repository files navigation

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: my_username@company.com # 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.

About

An example Microsoft Graph PHP application with OAuth 2.0 client credentials flow.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published