Automic Workload Automation

 View Only

  • 1.  Email Integration (Email Agent) using Microsoft OAuth2 Authentication

    Posted Nov 03, 2023 09:37 AM
    Edited by Josef Scharl Nov 14, 2023 07:57 AM

    Hi, 

    I'm working on an Email Agent which should connect to an Outlook 365 Mailbox using Microsoft OAuth2 Authentication.

    My peers in the Mailing Team registered "Automic" within Azure AD, granted the needed authorizations and finally gave me the Tenant ID, Client ID and Client Secret.

    I tried to set up the recommended "Run Mail Job with Microsoft OAuth2 using Client Credentials" (Integration Email - Agent Guide).

    In the Connection Object I specified:

    • Mail Server outlook.office365.com and User Name (= Mail Address).
    • The Token Request URL with my Tenant ID, the Client ID and the Client Secret.
    • Generic Body: &grant_type=client_credentials&scope=https://outlook.office365.com/.default
    • Properties: mail.imap.sasl.enable=true;mail.imap.sasl.mechanisms=XOAUTH2


    The part with the Tokes seems to work:

    Info: Access Token regenerated

     

    However, I get error messages.

    When I hook "Secure IMAP" (mail.imap.ssl.enable=true)

    Error: AUTHENTICATE failed.

    Without "Secure IMAP" (mail.imap.ssl.enable=false):

    Error: No login methods supported!

     

    I think there is something missing at the Azure part, but my peers swear, that it's ok.
    Any hint is very welcome.

    Thanks, Tscho

    PS: I'm using the latest Version: Integration.Email_Agent_21_0_1+build.1681740290834



  • 2.  RE: Email Integration (Email Agent) using Microsoft OAuth2 Authentication

    Broadcom Employee
    Posted Nov 24, 2023 09:48 AM

    Hi Josef,

    Authentication failure can stem from various factors. Have you adhered to the guidelines outlined in

    https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#use-client-credentials-grant-flow-to-authenticate-smtp-imap-and-pop-connections

    Furthermore, you might need to specify the following parameters in the Email Connection properties field.

    mail.imaps.auth.plain.disable=true;mail.imaps.auth.xoauth2.disable=false

    These additional settings might be necessary to ensure proper authentication.



  • 3.  RE: Email Integration (Email Agent) using Microsoft OAuth2 Authentication

    Posted Nov 29, 2023 03:04 AM

    Hi,
    "Authentication failure can stem from various factors" - so, true. We had at least 2 problems with our configuration.
    First was an insufficient permission for the mailbox. Second was the missing parameter you mentioned above.
    After setting permissions and adding the mail.imaps.auth parameters it worked.
    Thank you!
    KR, Josef