Gmail Oauth2 using Connections API

Hi All,

I’m a newbie so apologize if I’m missing something obvious. I have an Application with a bunch of users and I want to have those users be able to send emails using Gmail (using in the backend). My application is registered with Google and I have a clientId and clientSecret etc.

Currently, when a new user joins my application I can have them authenticate their Gmail account with my application using Oauth2 protocol (i.e. I redirect them to Google authorization url and redirect_url is set to my application where I receive the access_token and then exchange it for a refresh_token). Afterwards, my application has access to the user’s Gmail account even when the user is not present.

Now, if I want to setup a Gmail connection for each new user to my application, so that I can use Gmail app to do actions on behalf of the user’s account, how do I do that? Note that this needs to be done programmatically (i.e. I can’t manually setup each new users connection using the Dashboard UI).

I tried setting up a connection using the POST /connections api and providing the clientId and clientSecret but this gives me the “failed to load manifest error”. Furthermore, this will still not help me get authorized for a new user.

If I use the UI and use the module “Gmail” or “HTTP Make OAuth 2.0 Request”, I can “Add” a connection which pops open a webpage where the user can allow access etc. What I need is a way to do this part programmatically. Is that possible?

Thanks everyone. Hopefully, someone has a solution.

  • Abhinav

Hi @Abhinav_Kamra,

It is not possible to do Programmatic Connection Addition in Make for Google or other apps in Make that requires User Interaction during Connection settings.

This is the same flow that you are doing in your current application and it applies to Make as well i.e Users needs to explicitly grant permission to allow Make to establish a connection with such apps.

I believe you should be able to use the HTTP module in Make to trigger Google APIs through the user’s refresh/access token stored in your application but you won’t be able to use the Make Gmail app.