Demos a simple code flow to get an access token for Office 365 Calendar, Contacts and Mail API in Office 365.
Code is written w/o client library to showcase raw authorize and token requests.
Please use ADAL for real apps. See many examples at https://github.com/AzureADSamples.