Reputation: 1
I am creating a web application with the GAS app.
I want an unspecified number of users with G accounts to be able to select a Drive folder from the GAS app and grant the GAS app permission to that folder.
(I want them to be able to create files in that folder, etc.)
I can do what I want if I give the GAS app a Drive scope that allows access to all content in the drive, but when I apply for Google OAuth, I am told that the scope is too large and I am being told to use the Picker API.
even if I get a user to select a Drive folder using the Picker API, access to the folder from the GAS app is denied because the user does not have permission.
If anyone has been able to grant unspecified users access to the Drive folder using the Picker API in the GAS app, I would like to know how to do it and the code.
Upvotes: 0
Views: 58
Reputation: 38219
Handling file upload to Google Drive might be hard to catch.
On the other hand, understanding the settings of a web application created using Google Apps Script might be a bit hard.
The Google Apps Script owner might set the web app to be run as them. This is especially handy for creating a "dropbox" -> enabling users to upload files to a specific Google Drive folder.
There are other possibilities, like using a service account or redesigning "the flow", i.e., to ask users to upload the file to their own My Drive and share it, then use the script to make a copy.
Note:
Please note that Google Drive has changed over time, so when researching, please ensure that the post is current, i.e., the "old" Google Drive allowed folder editors to add, update and remove files to a folder owned by someone else; also users were able to add files to their folders. As mentioned above, the "new" Google Drive doesn't allow users to add files to someone else's folder on their "My Drive"; also, the folder on My Drive owners can't add files owned by someone else. One alternative is to create file shortcuts.
One option is to create a Google Form and include one or more File upload questions.
Related
Upvotes: 0