Errata
Chapter 12 (source code)
The tenant id for the two-legged example in the BtnLogon_Click event handler is hardcoded in the URL link. Replace the guid with your tenant id (follow the steps in this document to find your tenant id).
System.Net.WebRequest request = System.Net.WebRequest.Create("https://login.microsoftonline.com/e7b81d0a-a949-4103-83dc-feff6277c109/oauth2/token") as System.Net.HttpWebRequest;