I Did all that. See the log below from the sample app.
---LOG---
Redirect URL: http://localhost:8080/microsoft/
POST https://login.microsoftonline.com/organizations/oauth2/v2.0/token
Connected OK to: login.microsoftonline.com (40.126.32.136)
Request completed: 200 OK
Got New Access Token: eyJ0eXAi--------
Which Expires: 15/11/2022 14:16:09
Got New Refresh Token: 0.AR8AUJ0t-----
GET https://graph.microsoft.com/v1.0/me/
Connected OK to: graph.microsoft.com (40.126.41.160)
Request completed: 401 Unauthorized
Saved OAuth2 Refresh Token
Got New OAuth2 Bearer Token OK
! Starting SSL handshake
SSL Connected OK with TLSv1.2, cipher ECDHE-RSA-AES256-GCM-SHA384, key auth RSA, key exchange ECDH, encryption AESGCM(256), message auth AEAD
< +OK The Microsoft Exchange POP3 service is ready. [TABPADQAUAAyADYANQBDAEEAMAAyADUANQAuAEcAQgBSAFAAMgA2ADUALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]
Request Done Rq=0 Error=0 LastResponse="+OK The Microsoft Exchange POP3 service is ready. [TABPAD-----]" ErrorMessage="" Connected=True
Note the 401 Unauthorized. Not sure what that means as everything seems ok,
Then when I do pop3.auth I get
> AUTH XOAUTH2
< +
> dXNlcj10ZXN0ZXJAZn------
< -ERR Authentication failure: unknown user name or bad password.
Request Done Rq=16 Error=500 LastResponse="-ERR Authentication failure: unknown user name or bad password." ErrorMessage="-ERR Authentication failure: unknown user name or bad password." Connected=True
AndyC++