Services Plugins FAQs

How to use Google Drive Service Acc

Hello @ben

Thanks for sharing , however I would recommend to file a bug report to bubble: www.bubble.is/bug_report to file an official bug.
Also maybe try uninstalling, refresh the app and installing plugin again to give it another try.
Thanks for understanding.

Regards,
Dumitru.

Can we enable support for team drives? (support article) . It seems like a natural fit when using a service account with drive.

FYI I just spent hours troubleshooting permissions between Drive UI, G Suite Admin Console, & Google Cloud API Console for a 404 error I was getting only to find out that the plugin was not raising a simple supportsTeamDrives=true flag during the request that was causing this. Regular drive shares work fine, BTW.

To be fair, I may be underselling how ‘simple’ adding team drive really is because the supportsTeamDrives=true flag I mentioned is used as a way to qualify that application (your plugin) is aware of the added parameters, capabilities, and different behavior when accessing shared drives.

Anyways, I’m curious to know
Thanks

Hi there @jon1.

Let us check it out, thanks. I’ll be back to you asap with an update.

While I’ve got someone’s attention. Is anyone aware of the API limitations or SLAs are for Drive in G-suite? Rate & bandwidth limits? I’ve tried getting this info from Google, but G Suite support directs me to Google Cloud Platform support and Google Cloud Platform support directs me to G Suite support. I’m hoping you guys have some more insight :slight_smile:

From what I’ve seen posted on places like reddit / stack overflow its 10m (or 100m calls) a day and 750gb /month transfer. When compared this with Dropbox or Box this isn’t even close (25,000 and 15,000 calls a month respectively - unknown transfer). Given how different these offerings are, I’m wondering if Google is doing at a loss and will change the rules. We’ve seen how fickle google can be… I’ve also seen google drive ‘enterprise’ storage, which isn’t tied to G Suite and seems to have a different pricing model based on amount of transfer in and transfer out.

Any updates on wether or not this is possible? Not a rush though, I’m just trying to plan out where I’ll be storing these files.

Hi there @jon1

We’re still looking into this ticket, however it’ll take some time due to priorities for other issues. Thanks for understanding.

Regarding limits of the Drive API, as was talked in this thread: https://stackoverflow.com/questions/10311969/what-is-the-limit-on-google-drive-api-usage/10313416#10313416
and answered by a Google Drive engineer/employer the quota can be seen in Google’s API Console.
And as you see the answer is pretty much what the info is known to the public.

Hello @jon1

Regarding the support for TeamDrives, please upgrade the plugin to latest version, refresh the app and give a try.
Also would be a good idea to check the permissions settings to manage the members and drives:

Thanks for patience and understanding.

Regards,
Dumitru.

Hi @Dumitru, I have bought this plugin and as far as I can tell I have followed the instructions provided in this plugin’s documentation, and Google’s instructions to set up the service account correctly, however I am getting an error as follows:

When comparing configuration in your sample app I decided to test your Google Drive credentials in my app, and that worked without issue, so I believe the issue is with either my credentials or my service account configuration.

Looking at my credentials, I have noticed the private key in JSON file generated by Google Console has newline “\n” characters inserted throughout.

{

  "type": "service_account",

  "project_id": "task-labour",

  "private_key_id": "e19e3483310e3a0aa9e167e0a7d03d4455cb5f95",

  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCvP/kBrV3P9sMA\nzbmXkl4oDaOSJk3lyPPogDRFmKuD+/GveqDsyg/rel6RCtLZw6EuTBRvTErZCWrd\nmY0bWwP9rnerX36fZqlhDIo458kKwYs0jmdLs4fcQs/IqDIME3Poxp59BzDLama5\naNykynABnhln5mtnA95/8V2VcFrEOm8L1FHmNX4BMDur8ZM0eUdgNBh1c3MjmXmy\ncFcZhJmkAErW+JogrpsrJ1JpwWxyWGcTOG8VA97F9tApfAIsQ7NvKDhs+0Mk/dva\nC8t6w8VHGux6E1es3Y6OoxyJXq6Cxj1Ms8ePMn4cZzm8q47E2ExFQoycSFDNVZOp\nSYC0Cud/AgMBAAECggEABNXMLiPVNPHXIym0kf4rqImTy+pQTOOJ+I4M+HyZWCy2\ngtkXITauphhmt968vt2wZUFxG48BzlIoXNEp56l6XItDPvsFWIAxx9KGP8KutSQY\n40wohRoAyMQed9Ki1YV14GQWfFbwnYl5KGrAZ7A0KJSZmS3DedX3/hSv4yR0mfms\n/GnEMWQpYVTU1GtqSGRim7+RkQNPUpJPbFZBT5C38Nj/28aLd1pV3VRzTZx3tdzH\n1ob2eYD/nNqBZzBTBogKUvbBJX6AQZqrn1urBNWwBmTerkWZmbqmfObD707OvL/n\nyY+N69adxiuDmRWqo43EOjzrB6o33hB5cAZe/6gXYQKBgQDtn8QRwOp29gPdgW1m\nRWVm+etK4ZNU7950IQVwIjdhR0cPuZjsuvySjI+cgODD07RG1AvJW7rDrE9jKYeh\nwrXXo319jrXu6XZzyy3amW0YZvEhJlTYvdrDgIqrM0BTq31TRLnpoc7FsNAtRVtX\nDbqTcmpYnIuwzGbGpv8NzjnjXwKBgQC8zWMzi91b6/jheC91YRiwsRueOzF0jxn/\nvg+P8YQtBsT5+QBcHw00M+QlFp3hv2UACnzaIvqPSZXtjOmQBvVBhSYl/EPOlv/6\nEfDJ2dpRNvdzt2BpFXAb+/YDylhNQ8kcCYhAaUpKd3EjXUvF/tb2hzhkbl60rnYa\njDFu29iP4QKBgQDqqWwnXCwvbqRCix5OcRnCp+wE9t9YccltRW7pXeDy4ED89nxe\nzAnBb64jD+LngJn3mFBLeZrmwbNkag7XYEHTwlCbPePNHCEuGOgfiISEJKTb587C\nfDsd9kL67pIIDsKlCKnQX0qjUAlFq8iYH6axFbyP5YjOAA0/AIvARnhEYQKBgQC0\nwks8uabH8AdLDr8ZOUnjON2BQ5jYyH0Szcume4uZdEa4MP54ND53AUtnetzTmmO/\ng0r/qceL0d7aHTQscYz0Gt9oNLpSm10d9Xk8N/f+E4scXa/PS/gWwsdJ37tk1gZA\ncpvhVy0KWIqYWiVGvfLe+p0yAj1n7TQjvJ9DTPZs4QKBgArWuKwTGbjSCgeOBE3x\nUhWC98G1XAF7K4XYrxEGkLEK8apOm8u9txFXLncnDTbNPSpg1OxlQt5qYL1vUJbu\nGsueQ6BSUSHDp5Vin05pOooKzP6MSRQnVjmYLwBLD5XHEDn3Zs113FXWx7ZXXc94\nxmhCZMSl8LSZKP02T/HV7ftp\n-----END PRIVATE KEY-----\n",

  "client_email": "crm-336@task-labour.iam.gserviceaccount.com",

  "client_id": "106227267848194332711",

  "auth_uri": "https://accounts.google.com/o/oauth2/auth",

  "token_uri": "https://oauth2.googleapis.com/token",

  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",

  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/crm-336%40task-labour.iam.gserviceaccount.com"

}

Is this something you found when generating these keys during service account creation or is my Google Console being “special”? I have attempted to strip out these out but I get the same error and am wondering if in the process of searching and replacing I have otherwise corrupted the key.

Are there any other reasons known to yourselves as to why I might be getting this error (some config option in Google Console I may have overlooked or not covered in documentation?) I have both Admin SDK and Google Drive APIs enabled.

Finally, in an attempt to create credentials successfully I tried using the tool Jarrad created but am getting this error:

image

Other screen shots you might find usefull:

Google Console showing service account and creds:

Google Console showing Admin SDK and Google Drive APIs enabled (I assumed these are the only two I need for this plugin?):

Bubble plugin config (showing a version of the private key with newline characters stripped - I have tried original versions and some other variations all resulting in the same error):

Looking forward to hearing from you.

Mike.

Hi @mike1,

Thanks for reaching out. So based on this error and your screenshots, the problem is in the modified private key. It requires a bit of changes still:

The end of private key should be from a new line as well, so you need to add it by hitting Enter key, like here:

And please try to go through these docs again to make sure everything is in place. :pray:

Best,
Alex

Thankyou @alexandru. This error is no longer occurring now (I’m not I sure I have mastered the plugin yet but at least I’m not getting errors - the rest I can learn).

That was the first time I found that particular service account creation doc. It explains two things that are probably important for this process, including an additional permission to the account, and the explanation on replacing new line and “=” characters. I note this doc is linked off your Google Sheets plugin documentation and not your Google Drive (service acc) documentation. The doc for service account creation linked from the Google Drive (service acc) documentation does not include these points and if may be worthwhile amending.

Thanks again!

Hi @mike1,

Thanks for feedback. We’ll certainly work on improvements so it doesn’t confuse!

Cheers

Hi @mike1,

Here is the link to that second doc:

Thanks!

Ah, I see.

I was following the second link:

Actually, @alexandru - I’m struggling now to figure out how to use the plugin to download files after I have uploaded them.

You documentation suggests this is possible:

However, this API call, like a few in the list don’t appear in the plugin dropdown menu. (I am also looking for Search/Get files, listed as API call #1 in your documentation). As you can see from the screenshots below, neither of these call are available:


image

Although I can set permissions and filenames to do unauthenticated downloads of files I have uploaded via the plugin, I can see I will need to use the plugin to download them also as Google places limitations on unauthenticated downloads.

I followed the link provided under the API call listing for Download file but it take you to a page describing how to use the download API in languages like Java, Python or node.js and I am struggling to see what instructions I might need to be following to enable this for the plugin.

Can you help me understand why I can’t Search/Get File and Download File API calls from within the plugin?

These are actually actions, but what you are looking for are data calls used as Get data from external API:

image

image

image

Among with other data calls you can use like in a RepeatingGroup or any other place you find it mostly useful.

And for actions as well it is always easier to simply type in to search for an action, because they can be either in Plugins or Element Actions tabs so you don’t get confused.

Thanks!

This is great @alexandru - much appreciated! I now seem to have got past access restrictions by using the plugin to authenticate.

My final challenge is to be able to download a usable file. Whenever a file is downloaded it is not readable by the associated application. I apply all original file names correctly (so x.png files are downloaded as x.png file, y.docx files are downloaded as y.docx files etc.), but I still get unsupported format errors from the applications associated with those extensions.

My guess is this is due to needing to encode/decode correctly to and from Drive but I’m struggling to figure how, when and why to do this. I understand the conceptual difference between binary and base64 but am not clear why I would need to use one encoding format instead of another.

Can you provide some additional info? Again the links under Export File and Download File API calls don’t seem to describe WHEN you might choose to encode as base64 or binary.

Assuming I need to encode file with base64, HOW is the next question? Bubble doesn’t seem to have any native features to do this, but I note that Zeroqode (and a few others) offer a base64 encoding plugin. Will I need to use one of these?

Or perhaps this is not the problem at all?

I note that in your demo app for Google Drive (Service Acc) - the upload file button doesn’t seem to work in terms of showing an uploaded file in the Search/Get Files list, and there isn’t a function to download files from the list. If these things were working in the demo app I could probably work it out from there.

Hi @mike1,

Thanks for feedback! Actually we do have a demo example of downloading files by using the data call, and you can create a database field for storing it on download.

There is a RepeatingGroup called RepeatingGroup Get Folder Childrens item (Google Drive):

And the download button workflow:

So you can replicate on your side as well and give it a try. :pray:

Hope it helps.

Hi again @alexandru

Just to clarify, I did see this in your demo app, but there seem to be a few issues on this page which don’t seem to be working.

#1
Firstly, the upload button doesn’t seem to be working. In the screenshot below I have uploaded a .png image and then clicked the upload button, but nothing seems to happen:

This is unlike Create New File button which instantly updates the RepeatingGroup Search/Get Files item (Google Drive). It seems the difference between the two workflows of these buttons is that the Create New Button updates the “files” state variable of the page and the Update button workflow does not.

It will be important that I can upload files of different formats (rather than just create Google Files) so I can test to see they are encoded/decoded correctly and able to be opened by associated applications on download.

#2
In addition, I have not been able to successfully show the RepeatingGroup Get Folder Childrens item (Google Drive) you have referenced. From the element conditions it looks like it should show if I can successfully upload a file to a folder.

Which brings me to the third issue.

#3
The move file to folder button doesn’t seem to be working. Looking at the workflow I can’t see any particular reason why this should be but as per the screen shot below I have created a folder and tried to add a file to it numerous times but nothing seems to happen

Hi @mike1,

Thanks for getting back. Please let us investigate it with our developers as well, then get back to you with working solutions asap!

Alex