Search code examples
google-apps-scriptgmail-apigoogle-workspacegmail-addons

Gmail add-on connecting to non-Google Services without oAuth


Is it possible to authenticate to third-party service in G-Suite (Gmail) Add-ons, but without oAuth. The service I want to authenticate works on REST API and has no oAuth support.

The best for me would be to open a new window (as with oAuth), login there and return token to the Gmail add-on frame. If that won't be possible, I'd go with giving a username and password in dedicated Card in add-on, but I'm not sure it that solution will pass Google verification when publishing in Marketplace.

I'll be grateful for all the suggestions.


Solution

  • Unfortunately no. When connecting your add-on to third party services(ex. your application server), Gmail forces you to set up a separate authentication process for user to go through to use your services.

    However, if the non-Google service does require authorization, you'll have to configure OAuth for that service. You can make this process easier by using the OAuth2 for Apps Script library (there is also an OAuth1 version).

    Your service can still use Google OAuth to authenticate the user, you just need to set it up separately from your Gmail add-on.

    You can read more on it here: https://developers.google.com/gmail/add-ons/how-tos/non-google-services

    Also in my post I explain the process of connecting your non-google services to gmail add-on in more detail