有效Access Token下IMAP OAuth2登录失败排查求助
关于Office365 IMAP OAuth2认证失败的问题
我基于OAuth2 IMAP/SMTP实现的代码进行开发,获取到的令牌在Microsoft Graph API中能正常使用,但用它进行Office365 IMAP服务器认证时失败,报错信息如下:
Traceback (most recent call last): File "/Users/uttam/Documents/work/fast-api/imap_synching/.env/lib/python3.10/site-packages/imapclient/imapclient.py", line 415, in oauth2_login return self._command_and_check("authenticate", mech, lambda x: auth_string) File "/Users/uttam/Documents/work/fast-api/imap_synching/.env/lib/python3.10/site-packages/imapclient/imapclient.py", line 1738, in _command_and_check typ, data = meth(*args) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/imaplib.py", line 444, in authenticate raise self.error(dat[-1].decode('utf-8', 'replace')) imaplib.IMAP4.error: AUTHENTICATE failed.
我尝试用以下命令手动测试认证:
openssl s_client -showcerts -connect outlook.office365.com:993 -servername outlook.office365.com -crlf
但发现这个命令最多仅支持1024个字符,而我获取的令牌长度在4k-5k字符左右。不确定是令牌长度导致IMAP认证失败,还是存在其他问题,恳请各位提供技术帮助。
内容的提问来源于stack exchange,提问作者Lekhnath Parajuli
相关产品推荐
相关产品推荐

