O365 OAuth: An unknown error has occurred (mailsync: 3765269347)

After compiling the latest commit (as of 11 Nov 2020) and trying to add my O365 account using OAuth, the Mailspring webpage confirming the account was added shows after logging in, but the account window for the Mailspring app shows An unknown error has occurred (mailsync: 3765269347). The logs show the following result:

{ Error: An unknown error has occurred (mailsync: 3765269347)
    at ChildProcess._proc.on.code (file:///C:/Users/<>/Downloads/mailspring/app/src/mailsync-process.ts:227:25)
    at ChildProcess.emit (events.js:182:13)
    at ChildProcess.EventEmitter.emit (domain.js:442:20)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
  message: 'An unknown error has occurred (mailsync: 3765269347)',
  rawLog:
   '\r\nWaiting for Account JSON:\r\n\r\nWaiting for Identity JSON:\r\ninfo: Identity created at 1604894368 - using ID Schema 1\r\r\ninfo: Fetching XOAuth2 access token from Gmail for 2fcf1402\r\r\n' } { pluginIds: [] }
[19048:1111/165135.977:INFO:CONSOLE(101)] "Error: An unknown error has occurred (mailsync: 3765269347)", source: C:\Users\<>\Downloads\mailspring\app\src\error-logger.js (101)

So what this appears to me is that the mailsync process is expecting the Gmail token instead of the O365 token. But since we can’t look at the mailsync source, I’m not sure.


(Originally posted by csmith1210 on GitHub.)

I get the same error.

My email comes from GoDaddy, if that has anything to do with the issue.

If I try and use Outlook, still fails, this is the log file:

----------IMAP----------
connect <mailcore::IMAPSession:010FFA90>
* OK The Microsoft Exchange IMAP4 service is ready. [WQBUAFgAUABSADAAMQAwADEAQwBBADAAMAAzADgALgBDAEEATgBQAFIARAAwADEALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]
ssl connect outlook.office365.com 993 2
OpenSSL version: OpenSSL 1.1.0f  25 May 2017
1 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
1 OK CAPABILITY completed.
connect ok
login
2 LOGIN "jared@pi********ms.ca" "*********"
2 OK LOGIN completed.
3 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICATE CHILDREN IDLE NAMESPACE LITERAL+
3 OK CAPABILITY completed.
4 NAMESPACE
* NAMESPACE (("" "/")) NIL NIL
4 OK NAMESPACE completed.
login ok
5 LIST "" "*"
* LIST (\HasNoChildren) "/" Archive
* LIST (\HasNoChildren) "/" "Bulk Mail"
* LIST (\HasChildren) "/" Calendar
* LIST (\HasNoChildren) "/" Calendar/Birthdays
* LIST (\HasNoChildren) "/" "Calendar/United States holidays"
* LIST (\HasChildren) "/" Contacts
* LIST (\HasChildren) "/" "Conversation History"
* LIST (\HasNoChildren \Trash) "/" "Deleted Items"
* LIST (\HasNoChildren \Drafts) "/" Drafts
* LIST (\HasNoChildren) "/" Email_Templates
* LIST (\Marked \HasNoChildren) "/" INBOX
* LIST (\HasNoChildren) "/" Journal
* LIST (\HasNoChildren \Junk) "/" "Junk Email"
* LIST (\HasNoChildren) "/" Notes
* LIST (\HasNoChildren) "/" Outbox
* LIST (\HasNoChildren) "/" Send_Later
* LIST (\HasNoChildren \Sent) "/" "Sent Items"
* LIST (\HasNoChildren) "/" Tasks
* LIST (\HasNoChildren) "/" Trash
5 OK LIST completed.


----------SMTP----------
connect smtp.office365.com 587
220 YT1PR01CA0008.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 18 Feb 2021 15:30:44 +0000
init
EHLO plse495s007lt
250-YT1PR01CA0008.outlook.office365.com Hello [216.73.71.26]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
start TLS
STARTTLS
220 2.0.0 SMTP server ready
done
OpenSSL version: OpenSSL 1.1.0f  25 May 2017
init after starttls
EHLO plse495s007lt
250-YT1PR01CA0008.outlook.office365.com Hello [216.73.71.26]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
AUTH LOGIN
334 VXNlcm5hbWU6
amFyZWRAcGluZWxhbmRmYXJtcy5jYQ==
334 UGFzc3dvcmQ6
TWluZWNyYWZ0MTI0MTghQCQhKlBpbmVsYW5kZmFybXM=
535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit aka.ms/smtp_auth_disabled for more info. [YT1PR01CA0008.CANPRD01.PROD.OUTLOOK.COM]


SASL_PATH: 

SMTP Last Response Code: 535
SMTP Last Response: 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant. Visit aka.ms/smtp_auth_disabled for more info. [YT1PR01CA0008.CANPRD01.PROD.OUTLOOK.COM]


mailsmtp Last Error Code: 17
mailsmtp Last Error Explanation: MAILSMTP_ERROR_AUTH_LOGIN
mailsmtp Last Error Location: 10
mailsmtp Last Auth Type: 16

(Originally posted by JareBear12418 on GitHub.)

I’m having issues adding office 365 University account that has two-factor authentication on. On Thunderbird, I was able to login using oauth2 however I don’t like the UI of Thunderbird which is why I keep going back to MailSpring hoping to see oauth2 on MailSpring


(Originally posted by fx11111 on GitHub.)