I am testing the downloaded trail library on fetching outlook emails using Oauth2.0. I have successfully obtained refresh and access tokens using registered app. But when I use the sample code, shown below, to authenticate the IMAP connection, I got authentication error, "[AUTHENTICATIONFAILED] OAuth authentication failed.".
Can someone help? Thanks!
using (Imap imap = new Imap())
{
imap.ConnectSSL("imap-mail.outlook.com");
imap.LoginOAUTH2(emailAddress, accessToken); // cause error
imap.SelectInbox();
List<long> uids = imap.Search(Flag.All);
}