OfflineIMAP/offlineimap — pull request #72 by cscorley (2014-01-09 21:32:52+00:00)
Title: Initial XOAUTH2 implementation

Hi,

Opening this pull request for comments from the community. Not sure at the direction I've taken and would advice on what else to add so this makes it to the master branch.

To use you will need:

1. A Google OAuth2 client registered: https://developers.google.com/accounts/docs/OAuth2Login#registeringyourapp
- Be sure to change the default project name (under project Settings)
- You will need from this page:
- client_id
- client_secret
2. An email with this client authorized, namely the refresh_token, from performing an authentication. Easiest thing to do is to follow the steps here https://code.google.com/p/google-mail-oauth2-tools/wiki/OAuth2DotPyRunThrough

In your Repository, set the following configuration options:

[Repository gmail-remote]
type = Gmail
remoteuser = @gmail.com
oauth2_client_id =
oauth2_client_secret =
oauth2_refresh_token =

Should be ready to rock. This method may work on other IMAPs that support AUTH=XOAUTH2, but I have no server other than Gmail to test on. I've tested that this method also works for Google Apps Gmail accounts.