[Users] Oauth2 not working with Microsoft Exchange

David Fletcher David at megapico.co.uk
Mon Oct 10 15:25:30 UTC 2022


Paul Rolland <rol at witbe.net> wrote:

>(It is really goes to 127.0.0.1:8888, no surprise it fails...)

Hi Paul,

This part is OK. Assuming you are using the latest git version of Claws
then it will be listening for this connection on the local machine.

Background: There's code in prefs_account.c which listens for the
connection made during the oauth2 authorisation process at Microsoft.
Microsoft responds to part of that authorisation process by sending your
browser an HTTP redirect request causing it to connect to the local
machine, thereby passing the authorisation to Claws Mail. (Microsoft
does not contact Claws directly from outside your machine). You'll
notice the "redirect_uri=" part in one of the strings you posted:

> oauth2.c:327:Complete body: client_id=0a..........261I&redirect_uri=http://127.0.0.1:8888&
> grant_type=authorization_code&tenant=common&scope=offline_access 
> https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com
> /POP.AccessAsUser.All https://outlook.office.com/SMTP.Send

As Michael said, the error seems to be the tls handshake when Claws
attempts to contact Microsoft to obtain the Oauth2 tokens. Could you
have compiled against a dud TLS library?

Best wishes, David


More information about the Users mailing list