Google Drive API Public download private account files - javascript

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.

Related

is this possible with google authorization

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.

Generate expiring download link for newly purchased item

I am building a simple static website selling a single pdf file using the Stripe checkout api.
I would like to be able to generate an expiring download link after the customer successfully purchased the pdf.
I am really not sure about how to do this, but I was thinking about using firebase to store the file in a bucket and somehow use a cloud function to generate a temporary download link that expires after some time, but I am not sure how to go about this (or if this is even the best solution).
Can anyone give me some help about which direction to go here?
Firebase'd download URLs don't expire, although you can revoke the from the Firebase console.
But a better fit for your use-case might be to use Cloud Storage's signed URLs, which have a built-in expiration attribute. You can generate these with the Cloud Storage SDKs or Firebase's Admin SDKs, all of which should only be run in trusted environments - such as your development machine, a server you control, or Cloud Functions.
Also see:
A guide to Firebase Storage download URLs and tokens.
Get Download URL from file uploaded with Cloud Functions for Firebase

How to upload file > 15GB to Google Service Account

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.

Google Drive API limit Project to Specific folder with Read only access

We are looking to create a project for access to a specific folder with Read only permission.
My question is when creating the project what ways are there to limit access and permission in the project itself?
Can this be done? and is it through the enable APIs. I have done some reading on this and I cannot find a conclusive answer.
What APIs would I need enabled to apply this.
I will not be in control of any scripts, this will be a project for web application.
The scenario of what we have is Many thousands of files with in google drive, we want to give access to a specific folder and not have the ability to go through the rest of our google drive. They will be using Javascript to download files from this and upload automatically in to a system at there end, they are looking to use the Google drive API to do this.
Look forward to your replys opinions and direction on this.
Many thanks
you cannot do this at the project console level. you are missing info like how the webapp authenticates the user or whether the drive api calls are server side or client side. but in either case what you need is to never use the drive owner account and simply share that folder readonly public or to specific emails.
for a more detailed answer you need to explain much better the scenario.

Upload file to my google drive from anyone using javascript

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.

Categories

Resources