We are trying to log into the appreg using the following but it seems to be erroring out and say Limilabs.Client.IMAP.ImapResponseException: 'AUTHENTICATE failed.'
IConfidentialClientApplication app;
app = ConfidentialClientApplicationBuilder.Create(clientID)
.WithClientSecret(clientSecret)
.WithAuthority(authoriseEndpoint)
.Build();
var result = await app.AcquireTokenForClient(scopes)
.ExecuteAsync();
using (Imap client = new Imap())
{
client.ConnectSSL("outlook.office365.com");
client.LoginOAUTH2(userEmail, result.AccessToken);
client.Select("Inbox");
var count = client.CurrentFolder.MessageCount;
Console.WriteLine( count + " message(s) in Inbox");
client.Close();
}
Please let us know if this is supported.