I’m trying to invoke a Google Cloud Function via HTTP POST. This function requires authentication, providing a bearer token. For testing, we would generate a token manually and paste it as a header in our HTTP POST module in Make, and it worked.
The problem is these tokens expire after 1 hour. I’m aware that you can generate or refresh tokens programmatically in Python, however, we cannot run any code in Make right now (I think some services allow this, but we don’t have them).
Also, we don’t want to allow public access to the function.
I’d like to know if there is any way I can generate/refresh the necessary token in Make, or if I can invoke the function with a different authentication method that is compatible.
Here are some 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.
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 APIs for your custom app.
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:
To call google function you need identity token not an access token.
I achieved making authorized calls to a google fucntion by creating custom app in make which creates self signed jwt token and exchanges it for identity token of service account needed to call google function. It uses service account credentials for connection.
samliew solution may be possible with service account impersonation but I’m not sure it’s any easier to implement as i have no idea how to implement it.
Thanks for the info @Mikhail_Oskola. I don´t have enterprise so I can´t generate a self signed JWT (because I can´t run python). I will look how to do it by account impersonation as you said. Thanks in advance.
Another solution should be to use a OAuth call, but as far as I know, calling Google cloud functions is impossible by OAuth.
NOTE: Connection must be OAuth 2 (authorization code) type
NOTE: If this error shows “Function ‘jwt’ finished with error! error:0908F066:PEM routines:get_header_and_data:bad end line” then it has to do with the value provided (in the scenario) in the private_key field and the carriages return.
Solution 1 (better) in make scenario, in connection popup window, for private_key you must provide a multiline text but with Linux style new lines, not Windows style ones. This means getting rid of all “\n” in the JSON provided by Google and substituting them with new line feeds speacial characters
Solution 2 (worse) creating a variable in “common” part of CONNECTION and reading the private_key value from there (with appropiate \n"), thus not using parameters.private_key
And, yesss, finally working the call to the cloud function