<p>I've just been thru this with another project.<br>
The recommended approach is, do not save plaintext password with the application.<br>
Instead, save a revokable OAUTH2 token, which is possible to generate from the google OAUTH playground page.<br>
<a href="https://developers.google.com/oauthplayground/">https://developers.google.com/oauthplayground/</a><br>
The app (offlineimap, etc) can save the token on local disk file, and provide the token to gmail when gmail prompts for password. gmail will then login ok.<br>
The user can revoke this token at any time via their google account - in case their machine suffered a security breach - the bad guys won't have stolen their plaintext password - only the token - which the user will revoke and prevent further loss of data or financial money accounts (google wallet.. google adwords.. etc).</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OfflineIMAP/offlineimap/issues/228#issuecomment-131932089">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AKFSEIyyjE9pFbp7QEtqgBtG-_FzkMGaks5ooih6gaJpZM4FsaY2.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/OfflineIMAP/offlineimap/issues/228#issuecomment-131932089"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>