IMAP, POP, SMTP Connect with OAuth

As you all are aware about deadline for office 365 exchange online basic authentication closure is approaching so every admin or developer must kill the basic authentication in their exchange environment.

Some admins have already closed the gates for basic authentication by closing the pop/imap/smtp at the mailbox or Conditional access policy levels.

There are other admins or developers that are still struggling with POP/IMAP legacy authentications, I am not talking about SMTP authentication as Microsoft is not touching it as of now, but it is better to be prepared for that as well.

From Microsoft:
Basic Authentication Deprecation in Exchange Online – September 2022 Update – Microsoft Tech Community

Good News is for Developers and Admins that are not able to get rid of applications that are using POP/IMAP because whole rewrite of application is required.

Now there is a way to utilize oauth authentication and you will save tons of time as only authentication part of your application needs to be altered.

It is the same way as any other application that you register to AzureAD.

I am just mentioning the Summary and providing Links to Official documentation

  1. Register the Application

Register an application with the Microsoft identity platform

  1. Apply permissions

After that you can generate the token as you do for other rest api based app and utilize the access token to get access with POP or IMAP.

Whole process is shown in the below article.

Authenticate an IMAP, POP or SMTP connection using OAuth | Microsoft Learn

Microsoft has also mentioned the link to the TEST script so lot of readymade material is available for you.

This blog post is just to make aware everyone that time to completely shutoff basic authentication is near so go ahead alter your application before it breaks.



Thanks for reading….

Tech Wizard

PowerShell Fast Track


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s