I have been stuck all day trying to figure out how to keep an Oauth2 connection to a Google Analytics 4 API alive for more than an hour. The Oauth2 connection works great, but has a default time to live of 1 hour. So I have to manually refresh the authentication every hour. I can’t find any documentation or examples of getting a refresh token to work with Google (that don’t seem overly complicated anyway). Does anyone have a simple way to keep a Google Oauth2 authentication valid for more than an hour?
Here are my current settings that work one hour at a time.
@samliew Thank you so much for the detailed response! I did check that setting and I am fully published. I’m still not sure what to do as I can’t develop a webhook that I have to reestablish an authentication with Google every hour. Everything in my research is pointing me to a refresh token, but I can’t figure out how I would support that in Make.
@Tereza Thank you for your response and sorry for my delay. Just getting back to this challenge. Can you help me understand this a bit more. Currently I am using…
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.
Thank you for this information. When I add all of these to my app as listed below, the Oauth2 connection now throws an error that says Redirect URI Mismatch. It doesn’t seem like this is the right configuration. Everything was working with my original config (as imaged below), but the app would timeout every 60 minutes or so and force me to manually refresh the connection. Any thoughts on how to work around this? Or is there anyone in the community that I could hire to help here?
Do you use a custom app? If so, remove the expiration of refresh token from the connection’s code. Google doesn’t expire the refresh token and it is a common mistake of developers:
@Tereza Thank you for your continued interest in helping! I am obviously not an expert on this stuff. I have a Google Project setup that enables the Google Analytics API. I’m trying to just get a standard HTTP Oath 2.0 connection to not require a manual refresh all the time.
Unfortunately, the GA4 standard application within Make forces a property ID into the authorization connection which won’t work for me. So I need to create an HTTP call, but continue to run into timeout issues.
Any other thoughts, or reference where I can find this allusive “expires” setting.
Here is what I was able to figure out with help from support. This configuration allows me to authenticate a single time without me having to manually store a refresh token. It also allows me to query any property that I have permissions for by changing the property in the Base URL field. It’s not ideal because I have to manually write the full API query in the Body field. The whole reason I employ Make is so I don’t have to write API queries…but…it does work. Hope this helps someone else.
I can only use the GA4 “Make API Call” function. The other functions wouldn’t work for me.