buttercup / buttercup-browser-extension

:earth_asia: Buttercup browser extension
https://buttercup.pw
MIT License
230 stars 42 forks source link

Unable to open Buttercup Archive in Google Drive (G Suite) #314

Closed AdamTheRedBaron closed 4 years ago

AdamTheRedBaron commented 4 years ago

I am unable to connect the browser extension to my Google Drive. The extension authenticates fine, but when I hit "connect" I just get the Connecting box and spinner which then does nothing else. I'm using the latest version of the extension from Chrome Store and Firefox, W10 and Opensuse Linux, connecting to Google Drive on a G Suite account. The archive is in a folder named Buttercup in the GDrive root. I can connect no problem from the desktop apps on both OS.

AdamTheRedBaron commented 4 years ago

I am unable to connect the browser extension to my Google Drive. The extension authenticates fine, but when I hit "connect" I just get the Connecting box and spinner which then does nothing else. I'm using the latest version of the extension from Chrome Store and Firefox, W10 and Opensuse Linux, connecting to Google Drive on a G Suite account. The archive is in a folder named Buttercup in the GDrive root. I can connect no problem from the desktop apps on both OS.

An update on this. The file structure on gDrive finally appeared, but only after around 20 minutes of waiting. It looks like Buttercup is synching the entire structure of gDrive, not just the first level. My drive is pretty big, with complex folder structures and this seems to be causing a big delay.

perry-mitchell commented 4 years ago

We're hoping this will be fixed by #245 - Reducing the permission scope should result in much faster request times, as we don't really need to see the entire contents of someone's Google Drive. It does make it nicer when looking at a file tree, imo, but seems that having reduced permissions is just safer in general. We'll be attempting that soon.

AdamTheRedBaron commented 4 years ago

We're hoping this will be fixed by #245 - Reducing the permission scope should result in much faster request times, as we don't really need to see the entire contents of someone's Google Drive. It does make it nicer when looking at a file tree, imo, but seems that having reduced permissions is just safer in general. We'll be attempting that soon.

Thanks for the reply. I agree that it looks nice, but maybe it could be progressive? If the app (and browser extensions) just start by finding the top level folders and then build each tree as it is selected, the results would be much faster. That is one reason why I places my vault archives in their own folder in the gDrive root.

The dev team are doing great work by the way. Buttercup is by far the best pw manager that I've used so far.

perry-mitchell commented 4 years ago

start by finding the top level folders and then build each tree as it is selected

Unfortunately Google drive doesn't work like this! Otherwise we'd have most certainly taken this approach. Right now it returns pages of "items".. be it folders or files.. and we just have to ask for the next page, one by one. Quite terrible if you ask me. 😅

The dev team are doing great work by the way. Buttercup is by far the best pw manager that I've used so far.

You're too kind! Thanks for helping push this issue along 👍

perry-mitchell commented 4 years ago

If anyone feels like taking a crack at improving how we request files from Google Drive, please take a look at our google drive client.

vikaspotluri123 commented 4 years ago

@perry-mitchell I took a look at the Google Drive API docs and it's possible to get files in a folder (using the v3 API) by using queries. If you're willing to use the v2 API, it's 1000x easier because there's an endpoint for it

v3 API

Making an API request to https://content.googleapis.com/drive/v3/files?q=%27root%27%20in%20parents&key{redacted} gave me the list of files in the root of my drive. For reference, decoding the q URL param leads to 'root' in parents. root can be any valid folder id.

This is the API ref I was using and this the documentation I used for query.

v2 API

With the v2 API, it's as simple as hitting https://www.googleapis.com/drive/v2/files/folderId/children (ref)

perry-mitchell commented 4 years ago

Thanks @vikaspotluri123 - We're already using v3 of the API (https://github.com/buttercup/googledrive-client/blob/master/source/directoryContents.js#L74) - And I'm pretty sure that last time I debugged that library it was returning recursive contents. If you get a chance it'd be great if you might check out our implementation by firing it locally to see what you get? It uses pagination and seems to disregard directory levels (it returns parent IDs instead).

EDIT: Would preferrably not use v2 at all as we don't know when this will be deprecated.

perry-mitchell commented 4 years ago

This probably won't be necessary after reducing the permission scopes we use - so I'll probably close this for now as I believe this update will fix the issue. If it doesn't we can reopen.