Google Service Account Auth for REST API

It would be nice to be able to use Google Service Account Authentication for generic REST APIs. It could work the same way as for BigQuery, Storage and Firestore.

This would be useful for calling APIs deployed with Google Endpoints. With Endpoints I can deploy generic API backends and put service account authentication on top easily. If I could call these APIs with service account auth from retool just like for the other Google services I use it would save me from getting involved with OAuth2!

Since the auth is implemented for the other services already this feels relatively easy to add, so I hope you can do it!

Best regards,
Lars

4 Likes

Ping !
I'd like to use Google Calendar API with service account auth...
since retool workflow is enable, would be great to use it with service account...!

This has been filed internally and we'll keep this thread updated! :slight_smile:

2 Likes

Any progress on this?
I'm trying to connect my retool app to my google workspace's calendar, so I can create future events when retool apps create new records.

But, at the moment, I cannot use a google service account to allow retool to access and manage my calendar.

Is there another way to achieve this?

Thanks.

It would be helpful for us to have it as well, I would like to manage files in Google Drive using a service account.

No progress yet, but I just bumped this request internally and will post here with any updates! :crossed_fingers:

Hi. Any progress on this?
Is there a timeline?

My app is not working properly without the ability to connect use a service account for google Calendar API.

Thanks.

Still no progress here, unfortunately :frowning:

Would you mind sharing more about your use case here so I can pass it along with your +1 to eng? As a potential workaround, are you able to create a new REST API resource for each required endpoint with the specified parameters?

We will want this for sure as well. We are going to be needing to have retool interacting with a google drive on behave of the users using the retool app. The files created are not intended to be owned or registered to the individual that created them. It will be for a production management system where people will be able to upload images and such of problems or successes they are experiencing on the job. We do not want every user to have to have an authenticated google account and be signed into it to interact with the retool app. We want it to work the way the sample GSheets resource functions. It just seems to work no matter who is logged into and using an app. Maybe there is another way I am not understanding to get google drive auth working in a similar fashion?

Here's the detail of the issue:

  • My end user uses the app on a daily basis
  • The "google calendar" resource uses the current token from this user
  • After some days of use, for an unknown reason, the calendar resource starts failing
  • So far, re-authenticating from the resource itself has been the only way to resolve the issue
  • It seems that the refresh token URL is not working properly (see image)

Config of the resource:

In essence, how can I ensure that my end-user can use the app seamlessly and avoid the calendar API failing?

Thanks.

@victoria

Could you please advice on a solution for the above issue?
Thanks.

Hey @iairrozen!

Under the hood, we determine auth status by querying for the list of spreadsheets.


I wonder if you have not enabled the Drive API but have enabled the Sheets API as documented here, which might cause the auth verification to appear to fail as it can’t fetch a list of sheets, even though it can fetch a specific sheet.

We use the Drive API on top of the Google Sheets API, as the Google Sheets API is quite limited in terms of file-related functionality.

Can you make sure in your google cloud library for the project containing this OAuth app that the Drive API is enabled?

I am starting to plan out an app for us to use internally that I would need to write to a series of google calendars that we own, so having the capability to add a service account would be great.

Also I am also having to reauth every couple of days.

Hey @CCM! You shouldn't have to reauth every couple of days :thinking: Would you mind sharing a screenshot of your current resource setup page?

@victoria thanks for taking a look.

Were you able to figure out a workaround on this?

Hey @CCM!

You mentioned having to auth every few days - are you consistently using the app in between needing to auth or is it that, after leaving the app for some time, you need to auth again? Also, is this happening when you try and run a particular query? And are multiple users running into this same issue?

@Kabirdas thanks a million for getting back. Since I am building this out on the side, there were somedays between each use, so for the past few days, I have been running the query everyday, and its been working fine.

The issue was arising when I was trying to POST to my calendar, and I am the only user in my retool using it.

Thanks for all you all do!

:thinking: got it, good to hear that it's at least authing normally with regular use! If you do have a period where you're away from the app again for a bit I'd be interested to see what your token status looks like when you return before needing to auth again. You should be able to find it on the resource setup page:

Also when you say a "few days" could it be that you're needing to re-authenticate every 7 days? I'm wondering if you might be running into this refresh token expiration period, though it looks like that should only be true for SSO apps that have a "Testing" status.

Hello!

Just want to give a quick update here that REST resources should now support Google Service Account auth :tada:

2 Likes