connecting to Outlook 365 (IMAP and SMTP) using OAUTH2 , AUTHENTICATE failed (NO).

Hello all, I'm trying to connect to outlook 365 through my console application(C#) using OAUTH2 but I keep getting **AUTHENTICATE failed (NO)** when authenticating the connection. I have tried the same acquired token with another library and I was able to connect, Authenticate and read my emails. I also disabled the Multi factor authentication in Azure. Please advise. var clientApp = ConfidentialClientApplicationBuilder .Create("ClientID") .WithTenantId("TenantID") .WithClientSecret("ClientSecret") .Build(); var authenticationResult = await clientApp .AcquireTokenForClient(new[] { ""}) .ExecuteAsync(); var accessToken = authenticationResult.AccessToken; string rawToken = string.Format("user={0}{1}auth=Bearer {2}{1}{1}", email, '\x1', accessToken); string rawXOAUTH2Token= Convert.ToBase64String(Encoding.ASCII.GetBytes(rawToken)); ComponentPro.Net.Mail.Imap imap = new ComponentPro.Net.Mail.Imap(); await imap.ConnectAsync("", 993, SslSecurityMode.Implicit); await imap.AuthenticateAsync(rawXOAUTH2Token, ImapAuthenticationMethod.OAuth20); also, another question is, does ComponentPro supports connecting to Office 365 using OAuth2.0? if yes, then why there is the following summary for Enum 'ImapAuthenticationMethod.OAuth20'? // // Summary: // OAuth 2.0 authentication defined by Cheers,
edited 9/29/2022 2:13:27 PM
asked 9/28/2022 2:45:40 PM
add a comment

0 Answers

Your Answer

Not the answer you're looking for? Browse other questions tagged imap or ask your own question.