2

I'll have to use modern authentication for this project. it is an emergency requirement please help

I was using till basic authentication code and it was working just fine

exchange = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
exchange.Credentials = new WebCredentials("Mail_box_username","Mail_box_password"); 
exchange.Url = new Uri("exchangeServer");
exchange.Url.Host;

now it business has blocked basic authentication and asked us to use modern authentication

Kevin LaBranche
  • 20,908
  • 5
  • 52
  • 76
Chet
  • 21
  • 1
  • 5
  • What do you/they mean by modern authentication? Exchange web services can do NTLM for on premise solutions as well. OAuth 2.0 if you are talking to Exchange online which I imagine is not your case. https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/authentication-and-ews-in-exchange for some details with links to code examples. – Kevin LaBranche Jan 22 '19 at 14:04
  • which email provider you are using? – Jagadeesh Govindaraj Jan 22 '19 at 14:05
  • @Jagadeesh Govindaraj. office 365 – Chet Jan 22 '19 at 14:27
  • @Chet if your using IMAP There is no suuport for oath with IMAP.Other than that the rest api have a Oauth authentication .Please refer the following links – Jagadeesh Govindaraj Jan 22 '19 at 14:32
  • https://stackoverflow.com/questions/29747477/imap-auth-in-office-365-using-oauth2 – Jagadeesh Govindaraj Jan 22 '19 at 14:32
  • https://learn.microsoft.com/en-us/previous-versions/office/office-365-api/api/version-2.0/mail-rest-operations – Jagadeesh Govindaraj Jan 22 '19 at 14:32
  • https://office365.uservoice.com/forums/264636-general/suggestions/31942186-allow-gmail-oauth-modern-authentication-in-outlook – Jagadeesh Govindaraj Jan 22 '19 at 14:33
  • @klabranche lemme explain the situation in here. we had a .net(c#) tool which logs into mailbox and read mails and if the mail meets certain critiria then it again sends out an email business that there is some issue. it was working fine till yesterday and started giving error "The request failed. The remote server returned an error: (401) Unauthorized." when I checked with outlook admin team they said so "basic authentication is now blocked and we will have to use modern authentication mechanism to connect to" – Chet Jan 22 '19 at 14:39
  • 1
    Look at the OAuth code samples. You will have to move to that. https://blogs.technet.microsoft.com/exchange/2018/07/03/upcoming-changes-to-exchange-web-services-ews-api-for-office-365/ and https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth – Kevin LaBranche Jan 22 '19 at 14:46

0 Answers0