dropbox style file selection on webpage with google drive - google-drive-api

I'm working on a system for our customers (400+ web sites) which allow their customer to upload a file on their web page. So, to clear up that muddy description, our customer is CustomerA and customerA's customer is CustomerB. CustomerA will have a webpage that has a javascript link in it that points back to our servers. That javascript uses angularjs to inject some functionality into their (CustomerA) page. Part of that functionality is allowing customerB to upload files to customerA (actually it gets posted to our REST api and we deliver the file to customerA). Dropbox offers a quick and simple way to integrate this via their dropin javascript. I have that up and running and it was a breeze to set up.
So now I'm trying to figure out if there's a way to allow customerB who has a google drive account to click a button on customerA's site (via the angular injected code) that loads a popup window with their drive contents so they can select a file to upload/share. The way that dropbox does it is that when a user selects a file, I'm given a url to the file that expires after 4 hours. Is there something like this with the google drive sdk? Everything that I'm seeing/reading sounds like it's geared toward writing an app that integrates within google drive rather than google drive integrating with a web page. I also watched the quickstart video and learned how to set up an oauth app, but it looks like I have to register every domain for our customers that could be using our system - ugghh. Is that right? Thanks.

Related

Google authentication for Snapchat publish: is it possible with Google Apps Script?

I would like to download some data from Snapchat publisher dashboard using GAS. The problem I have is that the page can only be accessed after Google authentication (OAuth2?) and thus cannot be done using the HTTP request scripts I saw on SO. The website I want to access is here: https://publish.snapchat.com/
The data that interest me are pictures and CSV files that can be dowloaded via a "export CSV" button, even though pictures are my priority.
The only obstacle I see is the "sign in with Google" thing, that creates a pop up page to log in the Google account, and of course there is no other way to sign in for this web site.

Create shared Google Drive document owned by web service

I'm new to the Google APIs, and would like to write a small service class for my web application that:
creates blank Google document without user assistance
assigns a generated title
returns a URL that can be provided to multiple people to edit this document
This document mst be editable via a sharing link. Ideally it is owned/managed as part of the web service's Drive storage.
Code is welcome if it's easier than explaining, but I'm really asking for help understanding Google's service offering.
Can I fully authenticate using only credentials specific to my app? (e.g. call the Drive API without prompting an interloper/observer/user to
authenticate.)
Once authenticated, can I create documents local to my
API?
Whose quota are the created documents consuming, the person that created the API key?
Can I share
these created documents with others?
Will I be able to manage a list of
these created file URLs from a standard Google web UI?
Just to clarify what it is that you are asking. You want to be able to embed a google doc on your website A couple things that can happen here.
First, you will need to create a google doc, lets say a spreadsheet. Within that spreadsheet you will:
click File > Publish to the Web.
From here a new window will be brought up. Click Embed and Published content and settings and click the publish button. Ensure the Automatically republish when changes are made checkbox. (this will allow for your website to be automatically updated anytime that doc is changed.
Take the embedded link that is generated and plop it in your webpage and it will be live.
Now you can share the page via Google Docs and anyone that has that link can make changes to that spreadsheet. As soon as a change is made, it will update on your website with the next refresh.
Hope this is all clear, let me know if there is anything unclear.
Cheers

Generate a URL for Google Drive publicly shared files and access them

I have a collection of PDF files on a Google Drive. I have shared them and I want to be able to link to them from a list on a web site. What I'd like to be able to do is work out the file name of the PDF using information in the list. As a simple example, if my list contains items 1, 2 and 3 I'd like to be able to upload PDF files 1.PDF 2.PDF and 3.PDF to Google Drive then have the web site just link to those when a link is clicked and show the PDF files in the browser.
So, I guess I could do this just by uploading the PDF to Google Drive and manually adding a link to PDF on the web site. However, what I want to do is generate the link programmatically so that when I have, say, 50 PDF files I don't have to keep getting the link from Google Drive and adding it to the web site. The site should just work out that item 50, say, in the list will link to 50.PDF, for example.
I've tried to get the file id using the API but that requires the authorization token to be generated and manual intervention to take place, so that won't work. At least, not at the point where the file is viewed because the viewer is anonymous.
So my questions are:
Is it possible to work out what a file name will be on the drive using just something like an item number in a list?
I guess that there are maybe some other options - for example, when I add the items to the list on the web site programmatically, I could go and locate the google drive file manually using a web application and link it using the file id at that point. I could store the ID in a database - however, would any anonymous user then be able to just click on the file link on the web site and view the file?
Finally, can anyone think of another way to do this?
Any help would be appreciated! :)
Is it possible for you to use a service account? You can authorize the app with an account dedicated to your app and user doesn't need to authorize and authenticate. The files you will be uploading will be managed under the service account's Drive.
You can learn more about service accounts on https://developers.google.com/accounts/docs/OAuth2ServiceAccount
If you have implementation specific questions, please ask.

External asp.net mvc application accessing files on Google Drive

I would like to build an external asp.net mvc application that has the following features:
The application is accessible via its own domain such as www.itsowndomain.com
The application has access to one Google account (such as itsownaccount#gmail.com) where all the files are stored in the Drive folder. So the users of the application should not have to log into their own Google accounts in order to access the files from this application. The application needs to have automatic access to this (itsownaccount#gmail.com)'s google Drive, that process should be transparent to the user, they should never have to authenticate themselves, its should all happen in the code in the background when the application loads.
The application will use Google Picker to list the files that are in (itsownaccount#gmail.com)'s google Drive folder.
My questions are as follows:
Is what I am trying to do possible, basically using Google Drive as a storage of files and downloading them, uploading new ones and possible editing some from an external application?
Can I use one account because all the files should be publicly available so I do not want users to have to be thinking about authentication in a site just so they can view publicly accessible files?
How do I go about implementing this, is there a tutorial because the ones I have looked at all differ as they mostly try authenticate each user with their own Google account?
you can use Google Drive as the storage solution for your application, check the Google Drive SDK: https://developers.google.com/drive/
Google Drive application usually rely on the users' accounts to store their files, but nothing prevents you from using your account to store all files and make them publicly accessible
there's an ASP.NET MVC tutorial and sample app at https://developers.google.com/drive/examples/dotnet, however, it authenticates each user with his own account. You can start from it and replace the standard OAuth flow with one that always uses your credentials, for instance, by always using a Refresh token that you generated in advance and provided to the app.

Questions webstore

I need some light on the matter of Chrome Webstore registration.
I'm still confused despite searching through the web: the "app" will be only private for the site (we're trying to develop a Elgg plugin for our website that will allow users to access their drives).
1) for testing, do I need to register it (I did a search but some say yes like in the Google Drive SDK documentation, some say no in the google-drive-sdk tags)?
2) when the plugin is finished, tested and ready to go live for our users, do I still need to register it and pay 5$?
Thanks you for the answer you can provide us.
You don't need to register your app on the Chrome Web Store if you don't want to integrate with the Google Drive web UI: having the option to create a new file or open a file with your app directly from Google Drive.
Also, it might be easier for you not to create a Chrome Web Store listing while developing.
If you do need to integrate with the Google Drive web UI, but don't want your app to be public, you can publish your app to Trusted Testers only.