<div dir="ltr"><div>Hi,</div><div>I just started using offlineimap and I love it. It took me a while, however, to set it up to access gMail via a service key and domain-wide delegation of authority and I thought I'd share somewhere how to do it, as I don't think it's documented anywhere. Therefore, I have two questions: would you care for such a howto and which is the right place for it?</div><div><br></div><div>My use case is to back up a couple of Google Workspace accounts to an external storage. Therefore, I don't want every user to give me (the admin) the consent (i.e. the documented OAuth flow), nor do I want to manage their passwords for obvious reasons.</div><div><br></div><div>The solution is to create a service account with Google and delegate domain-wide authority to that service account (as per <a href="https://developers.google.com/admin-sdk/directory/v1/guides/delegation">https://developers.google.com/admin-sdk/directory/v1/guides/delegation</a>). OfflineIMAP doesn't seem to allow for using such a service key directly, but I made it work by abusing <b>oauth2_access_token_eval</b> to call a ~10-line python script, which generates the access token from the service key.<br></div><div><br></div><div>Thanks for a great piece of software<br></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Marek Dopiera</div><div><a href="mailto:marek@dopiera.pl" target="_blank">marek@dopiera.pl</a><br></div></div></div></div></div>