Google's Drive service is great, but their documentation is quite confusing...What I want to do is to create a portfolio site where upon request I fetch all files contained in a particular folder from my Google Drive (e.g. a photo gallery). This requires iterating through an amount of subfolders and store the file data in a JS object, XML feed or similar. Language is not so important. Simply using the "Publish to the web" feature won't do as I can only make manual requests and they're very limited.I've tried to use the Files: list provided in the SDK but it won't work without requiring OAuth 2. Found out that its possible to make a "domain-wide delegation of authority" and bypass its authorization but that would require me to set up a Google Apps domain. Seriously, all that to fetch some files?
My best guess now is to use the https://googleapis.com/auth/drive.metadata.readonly scope, but from there I'm out of ideas.
Related
So I have an application that I want to be able to read from BigQuery and perform queries, be able to read from GSheets to form these queries and upload this data into a directory in Google Drive.
I understand how to individually do these things, but for the sake of consolidating my system, I would like to use one set of credentials for everything. Is this a good way to go about building my system? I would like to follow the "least access possible" guideline to limit visibility to the database.
Is the best way to go about this creating multiple credentials? Should I use OAuth Credentials and include relevant scopes? Or can I create one set of credentials for all of this?
I'm using python for the backend, don't think that's relevant to the question though.
The proper way to handle this is to create the project using the Google API Console and authorize all the APIs needed for this project.
Afterwards, you will have to select the APIs needed by following the steps from this article here.
In order to retrieve the credentials for the project, you will have to select the project you created and based on the type of application you plan on developing, you will have to select the type of credentials needed.
Selecting APIs & Service
Selecting Credentials
Then based on your choice, you will end up retrieving the credentials and use them in your application.
Reference
Authorize Requests.
I have an application registered with google that asks users for permission to read and write all files in their google drive account.
I would find this alarming as an end-user, and my application does not in fact need the ability to read and write all files in the end-user's google drive account.
In fact I would only need the ability to read and write a single file, a file that my application creates.
Is something like this possible?
For example the scope here
https://www.googleapis.com/auth/drive
permits all access to all drive files.
I am not finding a way to limit the scope at the file, or even to a folder, which would be nice:
https://developers.google.com/identity/protocols/googlescopes
drive.file scope limits access to files that your app created. That sounds a good match for what you are asking for.
I'm really struggling here as I'm super new to Dot Net Core as well as Google Cloud Storage. I have looked over a lot of the available documentation online but I still can't understand on how to build the architecture.
So what I'm trying to build is a dot net core MVC application that has a form to upload a video file to Google Cloud storage (Google bucket probably?). The controller will take the data from the form and the Model layer is Google Storage.
Some pointers will be really helpful on how can I proceed about this task. Also some links to tutorials or any documentation if you guys think would be useful. Thanks a lot!!
It sounds like you're trying to get end users to upload files into Google Cloud Storage from their web browser. The trick here is that allowing any random anonymous user write access to your GCS bucket is a bad idea, but you also don't want to require that your users have Google Cloud accounts, either.
To resolve this, Google Cloud Storage offers a feature called "signed URLs." Your server uses its credentials to create a URL that is valid for a limited amount of time and, when presented to GCS by the end user, allows it to do a very specific thing as if it is your application's service account (in this case, uploading an object).
The flow goes like this:
Your app signs a URL for uploading an object to GCS and serves it as part of the page to the user.
The user does an upload to GCS using whatever JavaScript libraries you prefer.
If you want the user to use a literal POST web form, the signature is a little different than other cases. Look at the "policy document" section here: https://cloud.google.com/storage/docs/xml-api/post-object#usage_and_examples
Here's a sample that help answer half your question. It demonstrates how to upload a file to Google Cloud Storage:
https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/master/storage/api/Storage/Program.cs#L117
We've been using the Dropbox Sync API in our iOS app for the last couple of years. This API allows us to treat the user's Dropbox folder like a second file system, making it simple to access the contents. It also downloads and uploads new versions of files automatically, so we have to do very little work other than hooking it into our application. In short, it's a nice API that abstracted away all the "difficult bits" (file caching, etc) that was a pleasure for us to use.
Unfortunately, Dropbox are turning off the Sync API at the end of June, so we need to find an alternative. Moving to the new Dropbox "v2 API" would require us to reimplement the "difficult bits" of the old Sync API to provide the same functionality to users, so we're looking for alternatives in case there's a simpler solution.
Are there APIs to allow an app to access the user's Google Drive or OneDrive files, that are as simple to use as the old Dropbox Sync API? Ideally I want the API to handle all the caching automatically, so that we only have to say "open file X" or "overwrite file Y", and have it handle all the difficult bits (do I check the server for a new version of the file? What if I'm offline? Do I have a cached version saved here already? etc).
Or is that an outdated model, and we should just plan to use Apple's UIDocumentPicker API instead, to allow access to whatever cloud services the user has installed on their device?
As a background I have been looking to implement syncing with Dropbox within my application. It will deal with multiple files residing in folders across a users Dropbox.
Initially the Sync API seemed perfect for this however it does not allow the app to have Full Dropbox Access which is a must. I considered the 'File type' permissions type but some of the file types that my app will need access to are not listed as choices.
Are there any alternatives to the Sync API which give Full Dropbox Access or will I be needing to write a solution based upon the Core API to do this?
What file types do you need? We (Dropbox) do add new file types over time, so we're always looking for feedback.
For Full Dropbox access, yes, you'll have to use the Core API.