HTTP OAuth2 Module - How to get Refresh Token for Google APIs

I have a few scenarios where I take my WordPress blog post url’s and submit them to Google’s index using the API. This works for a few attempts but I noticed that after some time (or maybe the amount of attempts) I get an authorization response from Google and I have to go into my Make connection and edit the connection (1) and then reauthorize (2) be selecting my Gmail account. I should note I’m not making any changes to the connection but unless I edit first I cannot reauthorize.

I’m hoping someone has experienced this and has a solution.

image

1. Enable the API

Direct Link: Google Cloud console

2. Insert all the known Google Redirect URIs for your app

Direct Link: https://console.cloud.google.com/apis/credentials

How to create an OAuth app in GCP: https://www.make.com/en/help/tutorials/calling-google-apis-via-the--http-make-a-oauth-2-0-request--module ← FOLLOW THIS

Here are all the known redirect URIs you need for your Google Cloud Console OAuth app. If you set these up, you can reuse the same GCP app for other Google apps and modules on Make.

https://www.make.com/oauth/cb/oauth2
https://www.make.com/oauth/cb/google-custom
https://www.make.com/oauth/cb/google-restricted
https://www.make.com/oauth/cb/google-cloud-speech
https://www.integromat.com/oauth/cb/oauth2
https://www.integromat.com/oauth/cb/google-custom
https://www.integromat.com/oauth/cb/google-restricted
https://www.integromat.com/oauth/cb/google-cloud-speech

Once you’ve set these up, you can use/reuse the same Make connection for all the supported Google apps & modules on Make - you’ll only have to enable the respective APIs for your custom app in Google Cloud.

3. Publish your GCP OAuth2 app

Direct Link: https://console.cloud.google.com/apis/credentials/consent

You might need to set your OAuth application to “Production”, otherwise the credentials expire very frequently.

1. To do this, go to menu item “OAuth consent screen”

or click here https://console.cloud.google.com/apis/credentials/consent

2. Then click the button below if the Publishing status is not “In production”

4. Configure the HTTP OAuth2 module (if you are using the HTTP app)

You need a “Authorize parameters” key of redirect_uri with the above Make OAuth2 callback URL.

You can find the Client ID and Client Secret in the OAuth2 app you created in GCP, on the right-hand side of where you inserted the 8 callback URLs in step 2:

2 Likes

Thanks for replying but I already have it set to production so I’m not sure why I have to reauthenticate so frequently.

I suspect it may have to do with the refresh token field (when creating the OAuth connection).

In the HTTP documentation, the parameters for this field are:

Screenshot_2024-02-06_155517

Unfortunately it seems the tutorial for using the OAuth2.0 module for Google doesn’t cover how to do this specifically for Google.

In particular, I’m not quite sure how to access the “refresh token” when we are setting up the initial connection – because there is no “refresh token” yet!

I’ve bookmarked this topic so hopefully we can find a resolution – there have been a number of questions about this issue on the forums, but nobody has been able to solve this yet. I’m linking the old issues here so that the thread starters will get notified, perhaps one of them might have already solved this.

This also seems like something that should be handled by any OAuth integration automatically. You can try contacting Make support to see if the OAuth2 connection can be automatically updated with the refresh token. Directly contacting support can often lead to a faster resolution. They have access to internal tools and resources, which allows them to investigate more thoroughly than what we have access to.

If you manage to solve this issue, I’d love to hear about it! Sharing your solution on the forum can help others facing similar problems.

2 Likes

Hi @Tim_B , @samliew ,

You are correct. It does seem to be an issue with how Make.com handles the refresh token. I reached out to the make.com customer support and though they were very helpful in exploring different angles, I managed to get a custom app to work sooner and properly handle the refresh tokens (for Jobber).

@Thomas_Gaillard was also very helpful along the way and may be able to shed some light.

4 Likes

I managed to get a custom app to work sooner and properly handle the refresh tokens

How did you do that? I didn’t see a way to update the connection with a new token. What method did you use to handle the refresh?

Hi Tim,

how did you manage to get it in production. ?
Any idea what you did, so verification was not necessary ?
(in my case it says, verification not needed)

Best,

Jochen

Hi samliew,

in your screen, you can see, verification required.
And if you look into the screen about the requirements, you will see a demo
video is needed by google.

Did you create a specific video for that ?

Best,

Jochen

@Shawn I have issues with tokens not refreshing as well. To be honest I thought this was me, but it seems like a lot of people have issues with this. Do you have any information at all as to how you approached the solution you came to? Screenshots that you can share, etc.?

This is a big blocker for some of the solutions we’re trying to build with Make, so a solution would be a godsend to be honest!

Verification is not required if you are using it for personal use (i.e.: not publishing it on the app store for public installation).

For more information on Verification, see Gmail/Google Drive verification issues (error 400): how to solve

2 Likes

Hi @Bob_Balm,
I have it on my list to do a little tutorial with screenshots. If you have a particular issue with a custom app you are setting up please set up a question with screenshots of what you have and I may be able to help get you over the hump.

2 Likes