See http://googlecode.blogspot.com/2010/03/oauth-access-to-imaps... for some details.
Reply on news.ycombinator.com