diff options
Diffstat (limited to 'cloud_mdir_sync/gmail.py')
-rw-r--r-- | cloud_mdir_sync/gmail.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cloud_mdir_sync/gmail.py b/cloud_mdir_sync/gmail.py index dc70361..20e7502 100644 --- a/cloud_mdir_sync/gmail.py +++ b/cloud_mdir_sync/gmail.py @@ -89,7 +89,7 @@ class GmailAPI(oauth.Account): self.scopes = [ "https://www.googleapis.com/auth/gmail.modify", ] - if self.oauth_smtp: + if "SMTP" in self.protocols or "IMAP" in self.protocols: self.scopes.append("https://mail.google.com/") self.redirect_url = cfg.web_app.url + "oauth2/gmail" @@ -263,13 +263,13 @@ class GmailAPI(oauth.Account): async def close(self): await self.session.close() - async def get_xoauth2_bytes(self, proto: str) -> bytes: + async def get_xoauth2_bytes(self, proto: str) -> Optional[bytes]: """Return the xoauth2 byte string for the given protocol to login to this account.""" while self.api_token is None: await self.authenticate() - if proto == "SMTP": + if proto == "SMTP" or proto == "IMAP": res = 'user=%s\1auth=%s %s\1\1' % (self.user, self.api_token["token_type"], self.api_token["access_token"]) |