Still unable to setup email account for enable incoming email feature, using outlook 365

Hello!
I need help for setup Outlook 365 in email account to enable the incoming mail feature. Because I cannot find any official documentation from Frappe to integrate with Outlook 365 with OAuth.

I already setup Connected Apps doctype and Azure Active Directory (AAD) using personal email to get the credentials that needed.

There is a step in the frappe side that I try

  1. First, this is my frappe, and erpnext version :
    image
    I tried the newest tags of version 13 to have “OAuth” as the authorization method in the email account settings

  2. With OAuth as an authorization method there is a requirement to create Connected App document first, and I have created Connected App document that is filled with credentials from Azure Active Directory (AAD)


  3. After the Connected Apps document is saved, there is a button named “Connect to Microsoft” showed


    When I click that button there is an action that opens a new tab, first, open Microsoft login URI ( I assume should be from Authorization URI that filled in the Endpoint section in Connected App), then open the “redirect_url” that I set on Azure Active Directory (AAD).

  4. From what I investigated in frappe GitHub, that callback is supposed to receive code or authorization code from Microsoft token URI that I fill in Connected Apps, but it seems the callback did not receive any JSON data (because I try to hit the same link and payload that I capture when clicking the button “Connect to Microsoft”).

Another option that I tried to find the button “Authorize” in the Email Account document because there is an error told to authorize OAuth Authorization before saving the document.

from this post, I just found out that the “Authorize” button has a condition that seems to be mutually exclusive, so I try to modify the condition and I could show that button, but when I click the button, it hit same URI from Connected Apps before, but frappe throwing error:

Until I post this topic, I still didn’t know the best practice to set up Outlook 365 in Frappe Framework for enabling the incoming email feature.

Is there any solution regarding this issue? need advice, thank you.