I have an organization in my application and i want to link an google drive to that organization, so that users can upload directly to that google drive.
So flow:
Admin authorizes google drive (adds people (access) on google drive itself
User (who is added to that google drive) wants to upload something from my application
User authorizes their account and uploads their content. This gets uploaded in the drive of the admin
Are there any docs about this or where do i look? Can't seem to find anything related, so it may not be possible.
Related
I'm quite new Google Scripts. I'm trying to create a web app through which users can log in (with their Gmail accounts) and modify a Google Sheet. Here's a screenshot of the registration page.
Initially, the user logs in via their existing Google account and this page is displayed. Upon clicking the button, what I want is for the script to add their submitted information and their current email to a Google Sheet. Once their info is in the Sheet, they only need to log in via Google to gain access to the system. However, when I try this with another account I get this error:
Is this a permissions problem? Or does Google Scripts not allow this kind of direct manipulation of files on my Drive? Here are my permissions settings for my web app:
Is this at all possible?
From your question, I could understand that the settings of your Web Apps is as follows.
Execute the app as: User accessing the web app
Who has access to the app: Anyone
For above Web Apps, you want to make users access to the Web Apps using each browser.
Confirmation points:
From above situation, please confirm the following points. At first, I think that when the Spreadsheet you want to put the values is in each user's Google Drive, no error occurs. So from your question, I thought that the Spreadsheet might be in your Google Drive.
Although I'm not sure about your whole script, if the Google Spreadsheet which is used in your script of Web Apps is in your Google Drive, it is required to shared the Google Spreadsheet with the user. Even when the script of Web Apps is the container-bound script of the Spreadsheet and getActiveSpreadsheet() is used, it is required to share the Spreadsheet with the user.
When you want to put the values to your Spreadsheet in your Google Drive when the user submitted the form, please share the Spreadsheet with the user as the writer.
When you want to only read the values from your Spreadsheet in your Google Drive when the user submitted the form, please share the Spreadsheet with the user as the viewer.
Also, you can publicly share. But I thought that this might not be the direction you expect.
Other method:
If you don't want to share the Spreadsheet with the user, how about the following workaround?
Deploy new Web Apps as following settings.
Execute the app as: Me
Who has access to the app: Anyone, even anonymous
In this case, you can also make user access to this Web Apps using a key as the query parameter.
When Who has access to the app: Anyone is used, it is required to share the script of new Web Apps with the user. So I proposed to use Anyone, even anonymous for this situation.
When the form is submitted, the values are put to your Google Spreadsheet using this new Web Apps.
In this case, new Web Apps is used as the wrapper API for putting the values to Spreadsheet.
References:
Web Apps
Taking advantage of Web Apps with Google Apps Script
I have an app with google auth configured with firebase. can I use the token generated by firebase to access google drive documents?
I want the user logged in inside the app with Gmail auth to be able to read a document on Google drive that is shared with him.
I can't find anything online about this case.
I tried to open the document inside a webview but ask me to login to google drive
you have to follow these steps in order to make Google Sign-In and access to drive work.
Go to your credentials
Choose OAuth consent screen
Fill all the required details
Choose OAuth client id
Fill all the required details and For SHA1 key use this ‘keytool -exportcert -keystore ~/.android/debug.keystore -list -v’
Copy Client Id & use as reverse client id
NOTE image Android
Good Example
https://www.jellyfishtechnologies.com/blog/implement-google-drive-api-ionic-2/
I am trying to upload a file > 15GB to a google service account, using this snippet from Google Drive:
http://gsuitedevs.github.io/drive-utils/
https://github.com/gsuitedevs/drive-utils/tree/master/upload
Is there a way to upload files larger than 15GB here? Or, a way to modify it so that it will upload to my personal Google Drive (where I'm paying for storage) instead of a service account that has that limitation? If so, how would I do so?
There are a file storage limit on Google drive Upload files to Google Drive
Google Apps Free edition (legacy) Individual consumer accounts 15 GB
If you do an about.get you will see how much space the service account has access to. Service accounts are basic users and there is no way that i know of to give it more space.
Granting it access to your account
You can take the service account email address and share a folder on your google drive account with the service account. It will then have access to upload to that folder.
I've been searching a while and I can't figure this out.
I need to know if it possible and how to create an web app to allow someone to download a certain file (introducing on First and Last Name) stored on a Google drive Account. The issue is that this files has to be private in Drive.
Is this possible? If it is based on PHP, Javascript or jQuery better.
I know that I need Google Drive API, but which certificates should I use?
Thank you very much!
The Google Drive API uses OAuth2 for authorization. Most apps have the user go through the OAuth2 flow, so that app can access files in their Drive. If instead you want the users to download private files from your Drive, you can go through the OAuth2 flow once and then store the credentials so that they can be used for all users.
I am new to google api. I am able to do this file upload from app script and any file which is uploaded through that script get stored to my drive only.
But how to do this using javascript.
Example on google : https://developers.google.com/drive/web/quickstart/quickstart-js
shows how to do this but file gets uploaded to the same user's drive who is authorizing the app. How to restrict it to my drive only.
Thanks
Simple answer is you cant with JavaScript. The reason being is that JavaScript works with OAuth2 this requires that you ask the user permission to access your data.
If you want to have it access your drive account you would have to save the refreshtoken some place and then send that when ever the script was loaded. JavaScript is client sided so anyone that checked the code on the page would then have all the information they needed to do what ever they wanted with your drive account. Security wise that's a bad idea.
I recommend you look into using a server sided scripting language like PHP. You might want to consider a service account. Note: everything will be owned by the service account so you will either have to give the Service account access to your Google Drive files or you will need to move your drive files to the Service account.
If you don't want the service account to have the files you could go with normal Oauth2 save the refresh token and then store it in the server sided code there wont be as much of security risk there.