Authentication Failed (IMAP with OAUTH 2.0 from Python)

Victor Canto 1 Reputation point
2022-10-21T14:36:57.447+00:00

Hello everybody!

I'm always getting authentication failure when using IMAP with OAUTH 2.0 using Python. The following is an example of IMAP debug output.

16:26.93 > b'JMKC1 STARTTLS'
16:26.94 < b'JMKC1 OK Begin TLS negotiation now.'
16:26.98 > b'JMKC2 CAPABILITY'
16:26.99 < b'* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+'
16:26.99 < b'JMKC2 OK CAPABILITY completed.'
16:26.99 > b'JMKC3 AUTHENTICATE XOAUTH2'
16:27.01 < b'+ '
16:27.01 write literal size 2848
16:27.03 < b'JMKC3 NO AUTHENTICATE failed.'
16:27.03 NO response: b'AUTHENTICATE failed.'

Any idea what's going on?

Thanks!

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. risolis 8,801 Reputation points
    2022-10-26T07:08:03.52+00:00

    Hello @Victor Canto

    Thank you for posting this concern on this community space.

    I would say that this issue described previously has something to do with the following detail down below:

    254211-image.png

    Here it is the link related to that https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online

    I hope you can find this useful to overcome your concern and if further details are required, please do not hesitate to let us know.

    Looking forward to your feedback,

    Cheers,

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.