OAuth2 and Indy idIMAP

Does anyone have experience setting up/converting to/using OAuth2 authentication with isIMAP component from Indy? Is it possible?

Looks like it’s a work in progress

I have a demo project here that I created. My code is separate from Vincent’s link.

Thanks this is all promising… Office365 is going to cut off basic authentication in October.
I only use it for IMAP email retrieval from a service application. Looks like there is no way around this and even OAuth2 will require manual intervention to refresh the token.

After the initial authentication, the refresh token can be stored for later use. I am not sure how long this would last for… but typically it is 6 months after authentication and sometimes it is after last used. I am not sure exactly what expiry Microsoft uses, some google searches may help you with that answer.