This is a simple example on how to get an authentication token to work with the Microsoft Graph for a public application
Go to https://apps.dev.microsoft.com/ to register a new app
This app uses the new MSAL library. To get more information on it please visit https://github.com/AzureAD/microsoft-authentication-library-for-dotnet