Demos a simple code flow to get an access token for Office 365 Calendar, Contacts and Mail API in Office 365.
You need to create and configure your own AppID.
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.
This code sample is also life at: https://code-flow.azurewebsites.net/Home/.