-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Google Picker #5443
base: main
Are you sure you want to change the base?
Draft: Google Picker #5443
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/lodash@4.17.21), npm/process@0.11.10), npm/tslib@2.7.0) |
Diff output filesdiff --git a/packages/@uppy/provider-views/lib/index.js b/packages/@uppy/provider-views/lib/index.js
index 3e5b730..319f9c4 100644
--- a/packages/@uppy/provider-views/lib/index.js
+++ b/packages/@uppy/provider-views/lib/index.js
@@ -1,2 +1,3 @@
+export { default as GooglePickerView } from "./GooglePicker/index.js";
export { default as ProviderViews, defaultPickerIcon } from "./ProviderView/index.js";
export { default as SearchProviderViews } from "./SearchProviderView/index.js";
diff --git a/packages/@uppy/transloadit/lib/index.js b/packages/@uppy/transloadit/lib/index.js
index 5d77af0..6e48521 100644
--- a/packages/@uppy/transloadit/lib/index.js
+++ b/packages/@uppy/transloadit/lib/index.js
@@ -458,6 +458,7 @@ function _getClientVersion2() {
addPluginVersion("Facebook", "uppy-facebook");
addPluginVersion("GoogleDrive", "uppy-google-drive");
addPluginVersion("GooglePhotos", "uppy-google-photos");
+ addPluginVersion("GooglePicker", "uppy-google-picker");
addPluginVersion("Instagram", "uppy-instagram");
addPluginVersion("OneDrive", "uppy-onedrive");
addPluginVersion("Zoom", "uppy-zoom"); |
// NOTE: photos is broken and results in an error being returned from Google | ||
// .addView(google.picker.ViewId.PHOTOS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an old method of using Google Picker I believe @mifi. There is a new picker API for Google Photos and I believe it'll have to be a separate implementation: https://developers.google.com/photos/picker/guides/get-started-picker
At least how it appears to work is by making a POST request to https://photospicker.googleapis.com/v1/sessions
which returns a few things including a pickerUri
which can then the user can select photos in another tab/window using that URI from their Google Photos library for all photos and albums: https://developers.google.com/photos/picker/reference/rest/v1/sessions/create
However, I don't think Google allows you to access shared albums, etc. anymore at all unfortunately. So it just has to be something the user has in their library or album directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup I just found out about it too, i've done some testing and it seems to be working. It's a pity that shared albums don't work, but what can we do
Initial POC of Google Picker.
closes #5382
closes #5469
How to test:
Google Developer console setup
Instructions for enabling the Picker API in the Google Developer console for the first time:
https://console.cloud.google.com/apis/library/photospicker.googleapis.com
apiKey
clientId
appId
Now set
VITE_GOOGLE_PICKER_CLIENT_ID
,VITE_GOOGLE_PICKER_API_KEY
,VITE_GOOGLE_PICKER_APP_ID
in your.env
file and runyarn dev:with-companion
Problems/discussion
redirect_uri
needs to be frontend URI, and wilcard is not allowed. Update: I've madeappId
,clientId
andapiKey
as Uppy options (not Companion) so this should be OK because people can then use their own credentials.TODO
tsconfig.json
(I have just copy-pasted from google photos)tsconfig.build.json
(I have just copy-pasted from google photos)google-picker.mdx
(I have just copy-pasted from google photos)google-picker/README.md
(I have just copy-pasted from google photos)onPicked
add the files along with any metadata needed by companion to download the files, like accessToken, clientId etc.clientId
,scope
,accessToken
. The endpoint will callgapi.client.drive.files.get
, and stream (download/upload) the file to the destination (e.g. tus/s3 etc). Need to make sure the endpoint is secure somehow in a way that it cannot be abused/exploited.this.provider
is not needed in GooglePicker.ts