Easy MSA OAuth in Windows Forms
Sometimes when you want to quickly demo something, writing a quick Windows Form app is the easiest thing to do. It's not the "modern" way to write software, but if you're just trying something out it's easier to get bits running.
To that end, I've been writing a number of little apps to test various OneDrive integration pieces lately. I found I often needed a quick and easy way to do OAuth 2.0 flows using Microsoft Accounts. I borrowed some code and whipped up an easy-to-use Windows Form class that easily gets back either an access token (implicit grant flow) or authorization code (authorization code grant flow) that I'm now using in all of these projects. If it's useful for me, I figure it may be useful for someone else, so I've posted it as a Gist over on GitHub.
https://gist.github.com/rgregg/6f7332e998e76a16bbac
Feel free to fork, comment, or submit pull requests for improvements!
Update: I've posted the latest version of this code as a NuGet package that makes it easy for anyone to consume it. Check out the OAuth Library for Microsoft Account.