When using cloud-mdir-sync only for smtp and imap with O365, I occasionally get an error that expires_at key is missing from the owa_token:
(base) stain@xena:~$ bin/cloud-mdir-sync
07-27 08:55:31 DEBUG Starting Loading cached state
07-27 08:55:37 INFO Completed Loading cached state, 12311 msgs, 49126 cached ids (took 5.6297 secs)
07-27 08:55:37 INFO Starting Azure AD Authentication for soiland-reyes@manchester.ac.uk//common
07-27 08:55:38 DEBUG Credential request 'SMTP' [] 'soiland-reyes@manchester.ac.uk'
Task exception was never retrieved
future: <Task finished name='Task-11' coro=<CredentialServer.handle_client() done, defined at /home/stain/miniconda3/envs/email/lib/python3.11/site-packages/cloud_mdir_sync/credsrv.py:37> exception=KeyError('expires_at')>
Traceback (most recent call last):
File "/home/stain/miniconda3/envs/email/lib/python3.11/site-packages/cloud_mdir_sync/credsrv.py", line 58, in handle_client
xoauth2 = await account.get_xoauth2_bytes(proto)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stain/miniconda3/envs/email/lib/python3.11/site-packages/cloud_mdir_sync/office365.py", line 497, in get_xoauth2_bytes
or self.owa_token["expires_at"] <= time.time() + 10):
~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'expires_at'
07-27 08:55:38 INFO Completed Azure AD Authentication for soiland-reyes@manchester.ac.uk//common (took 1.2742 secs)
07-27 08:55:44 DEBUG Credential request 'SMTP' [] 'soiland-reyes@manchester.ac.uk'
Not sure why the attribute is missing - is that a good sign or bad sign? It is not required by RFC 6749 although that specifies expires_in (seconds remaining). Here is all I found in self.owa_token:
When using cloud-mdir-sync only for smtp and imap with O365, I occasionally get an error that
expires_at
key is missing from theowa_token
:Not sure why the attribute is missing - is that a good sign or bad sign? It is not required by RFC 6749 although that specifies
expires_in
(seconds remaining). Here is all I found inself.owa_token
: