[Oauth 2.0] imap Office 365

0
Hi, I'm trying to authenticate on microsoft office 365 using Oauth 2.0. I always have the following error with the dll : "AUTHENTICATE failed (NO)." My Azure App, and my token are OK, i can authenticate using another librairy. Could you help me ? My code : using (Imap _imap = new Imap()) { _imap.Connect("outlook.office365.com", 993, ComponentPro.Net.SslSecurityMode.Implicit); _imap.Authenticate(_return.access_token.Value, ImapAuthenticationMethod.OAuth20); _imap.Disconnect(); }
 
asked 8/10/2022 7:55:15 AM
add a comment

2 Answers

0
Hi Martin, thanks for your message, the ressources are : ![enter image description here][1] And the token is : ![enter image description here][2] the scope seems to be OK, and I use directly the acces_token to authenticate, but unsuccessfull [1]: https://download.isi-com.com/tmp/api.png [2]: https://download.isi-com.com/tmp/token.png
 
answered 8/10/2022 9:50:44 AM
add a comment
0
Hi Sebastien, You need to check the resource for which the token is generated. IMAP and SMTP scopes are targeted for Exchange resources. You should generate a token by calling to /token. With the IMAP, SMTP scopes are generated for the Exchange resource. Protocol Permission scope string 1. IMAP https://outlook.office.com/IMAP.AccessAsUser.All 2. POP https://outlook.office.com/POP.AccessAsUser.All 3. SMTP https://outlook.office.com/SMTP.Send Hope this answers your question Thanks for contacting us.
 
answered 8/10/2022 8:26:52 AM
  Hi Martin, could you help me ? My ressources are described in my previous message. Thx Sébastien 8/12/2022 8:03:49 AM
add a comment

Your Answer

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