title: How to debug/trace ADAL authentication?
body: <p>I was trying one of the Azure Active Directory samples Microsoft has published here: <a href="https://github.com/AzureADSamples/WebApp-WebAPI-OpenIDConnect-DotNet" rel="nofollow">https://github.com/AzureADSamples/WebApp-WebAPI-OpenIDConnect-DotNet</a></p>
  
  <p>I managed to screw up the audience value in the web.config for the TodoListService and got a 401 Unauthorized response when calling the service.</p>
  
  <p>The problem is, it took me way too long to figure out what was wrong. Running it in the debugger did not  produce any helpful trace statements in the output window. There were also no events in the event viewer.</p>
  
  <p>Is there any configuration I can turn on which would have helped my find this more quickly? Is there middleware with logging or diagnostic capabilities that I could use to debug this?</p>
  
  <p>I suppose I could have grabbed the sources from <a href="https://github.com/AzureAD/azure-activedirectory-library-for-dotnet" rel="nofollow">GitHub</a> and tried to debug the issue, but that is hardly convenient. Is there anything I'm missing?</p>