<div dir="ltr"><div>So TOTP with Google was not an option, because they require you to give them</div><div>a phone number and they send an SMS to it (at least initially).</div><div><br></div><div>I did not want to go that route. In fact, they did have my cell number and I removed</div><div>it from my account. The reason is not privacy, but something more dangerous. Someone</div><div>I know was the victim of a SIM swap attack, not once, but twice. Basically an attacker</div><div>convinces the cell phone provider that he owns the number, and gets a SIM. He then</div><div>goes into Google and asks for a password reset. Now any other service that uses the</div><div>Google email is also compromised. <br></div><div><br></div><div>What I ended up using for getmail (to backup my Gmail account over IMAP) is use the</div><div>Xoauth2 method supported by getmail. To do this I had to use a Python program that</div><div>renews a token from Gmail using cloud apps<br></div><div><br></div><div>This is the script I used:</div><div><br></div><div><a href="https://github.com/akkana/scripts/blob/master/gmail-oauth-tokens.py">https://github.com/akkana/scripts/blob/master/gmail-oauth-tokens.py</a></div><div><br></div><div>I had to make a small change, adding float() around a value:</div><div>if time.time() >= float(expired):</div><div><br></div><div>In getmail's config, the following is needed:<br></div><div><br></div><div>use_xoauth2 = True<br>password_command = ("/usr/local/bin/gmail-oauth-tokens.py", "/home/path/to/gmail.json")</div><div><br></div><div>The steps to setup a cloud app with XOauth2 is as follows (from comments in another <br></div><div>program):</div><div><br></div><div>- create a project<br>   <a href="https://console.cloud.google.com/projectcreate">https://console.cloud.google.com/projectcreate</a><br>- consent screen:<br>   <a href="https://console.cloud.google.com/apis/credentials/consent">https://console.cloud.google.com/apis/credentials/consent</a><br>   only external available for non-workspace users.<br>   [ADD OR REMOVE SCOPE] <a href="https://mail.google.com/">https://mail.google.com/</a><br>   Test User: Add all your emails you want to use with getmail.<br>- credential:<br>   <a href="https://console.cloud.google.com/apis/credentials">https://console.cloud.google.com/apis/credentials</a><br>   [Create Credentials/Oauth client ID] Desktop App / getmail<br>-  download json</div><div><br></div><div>It works well. <br></div><div><br></div><div>But the mailwatch widget for XFCE does not work, and does not have a way to use</div><div>the above tokens<br></div></div>