Legacy Dev Forum Posts

 View Only

Sign Up

Integration GMail Workspace with Custom SMTP Server using OAuth 2.0

  • 1.  Integration GMail Workspace with Custom SMTP Server using OAuth 2.0

    Posted 06-05-2025 19:03

    Rui_Tomas | 2023-09-06 11:47:31 UTC | #1

    Hello, we had configure outbound email, using Custom SMTP Server integration. Our customer uses Google Gmail as email platform on his company. First we configured Basic Authentication, but to do that the customer had to configured Google Less Secure Apps, and it works fine. But our customer wants other option that does not need Google Less Secure Apps, due to secure resons. We are trying to configure authentication with OAuth 2.0 and activate Gmail API, but without sucess.

    Thanks, Regards,

    Rui Tomás


    Rui_Tomas | 2023-09-07 09:24:50 UTC | #2

    Our configuration:


    vpirat | 2023-09-07 15:26:12 UTC | #3

    Hi,

    Looks like the OAuth2 token request is rejected. The error message tells you that this type of grant is not supported. I could not find anything in Google doc on what grant types they do support. After some wider search on the net, I could find this article: https://stackoverflow.com/questions/40102110/can-i-use-grant-type-client-credentials-for-google-api

    It seems that Google supports only authorizationcode and refreshtoken flows.

    Custom SMTP server handles currently only the password grant type. We plan to support client_credentials grant type as well but it does not seem that will help. Those two grant types allow non interactive logins.

    You may try also to test manually with a curl command for getting the OAuth token (or using any http tool):

    Password grant: curl -v -k -H "Content-Type: application/x-www-form-urlencoded" \ -H "Authorization: Basic base64(appid:appsecret)" \ -X POST "https://oauth2.googleapis.com/token" \ -d "granttype=password&username=username&password=password&scope=yourscope"

    If this works, then SMTP integration should work as well.

    clientcredentials grant: curl -v -k -H "Content-Type: application/x-www-form-urlencoded" \ -H "Authorization: Basic base64(appid:appsecret)" \ -X POST "https://oauth2.googleapis.com/token" \ -d "granttype=clientcredentials&scope=yourscope"

    I think you should open a ticket with Google to get confirmation of what precisely they do support or not.

    Let us know.

    Best regards, V.P.


    system | 2023-10-08 15:26:45 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 21867